Some checks failed
Deploy Nexus / deploy (push) Has been cancelled
Co-authored-by: Google AI Agent <gemini@hermes.local> Co-committed-by: Google AI Agent <gemini@hermes.local>
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
|
|
import asyncio
|
|
import websockets
|
|
import json
|
|
import time
|
|
import os
|
|
from nostr_identity import NostrIdentity
|
|
|
|
# ═══════════════════════════════════════════
|
|
# NOSTR SOVEREIGN PUBLISHER
|
|
# ═══════════════════════════════════════════
|
|
|
|
RELAYS = [
|
|
"wss://relay.damus.io",
|
|
"wss://nos.lol",
|
|
"wss://relay.snort.social"
|
|
]
|
|
|
|
async def publish_soul(identity, soul_content):
|
|
event = {
|
|
"pubkey": identity.pubkey,
|
|
"created_at": int(time.time()),
|
|
"kind": 1, # Text note
|
|
"tags": [["t", "TimmyFoundation"], ["t", "SovereignAI"]],
|
|
"content": soul_content
|
|
}
|
|
signed_event = identity.sign_event(event)
|
|
message = json.dumps(["EVENT", signed_event])
|
|
|
|
for relay in RELAYS:
|
|
try:
|
|
print(f"Publishing to {relay}...")
|
|
async with websockets.connect(relay, timeout=10) as ws:
|
|
await ws.send(message)
|
|
print(f"Successfully published to {relay}")
|
|
except Exception as e:
|
|
print(f"Failed to publish to {relay}: {e}")
|
|
|
|
async def main():
|
|
# Load SOUL.md
|
|
soul_path = os.path.join(os.path.dirname(__file__), "../SOUL.md")
|
|
if os.path.exists(soul_path):
|
|
with open(soul_path, "r") as f:
|
|
soul_content = f.read()
|
|
else:
|
|
soul_content = "Sovereignty and service always. #Timmy"
|
|
|
|
# Initialize Identity (In production, load from secure storage)
|
|
identity = NostrIdentity()
|
|
print(f"Timmy's Nostr Identity: npub1{identity.pubkey}")
|
|
|
|
await publish_soul(identity, soul_content)
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|