feat: Nostr relay publish + availability subscription via nostrclient (#2) #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/nostr-relay-publish"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Makes chatelet's Nostr layer real, over the nostrclient extension's relay manager in-process (the spirekeeper pattern). Closes the publish/availability portion of #2.
What's wired
_sign_and_publish— sign as operator (resolve_signer), optional NIP-44 encrypt,nostr_client.relay_manager.publish_message(...). Soft-fails (logs, returnsNone) on: no operator onboarded, nostrclient absent, or signer can't encrypt. Never crashes the booking flow.publish_listing(30402),publish_block_calendar(31923), and the22001availability reply — all need onlysign_event.publish_reservation(30078) NIP-44-encrypted to the guest — soft-fails on aLocalSigneruntil a bunker/server-signing signer lands (lnbits #18).subscribe_inboundpermanent task answerskind:22000availability queries withkind:22001— the client-agnostic availability path parallel to the RPC.22000/22001are plaintext (availability is public info), so this path works today.Public vs encrypted — deliberate
A
LocalSignersigns but can'tnip44_encrypt(bunker-forward by design). So public discovery + availability publish now; encrypted delivery (reservation, and the #5 DM) sign-encrypt via the signer and soft-fail cleanly pre-bunker. Honest and strict-from-start — no vendored plaintext-nsec fallback.Cleanups
_plaintextbuilder scaffolding (service.py encryptscontentin place) and a broken{operator_pubkey}calendar tag.Tests
make test): +4 event-builder tests (tag/kind/content shape for 30402/30078/31923/22001).service,events,transport_rpcsload clean).Soft dependency
Adds a soft runtime dependency on the nostrclient extension (like nostrmarket) — noted in the README +
event-flow.md. Absent → publish/subscribe skip, booking flow unaffected.Follow-ups
Why PR
Money-adjacent extension → PR category. Handing off merge to you via the Forgejo UI.
🤖 Generated with Claude Code
Wire the Nostr layer through the nostrclient extension's relay manager in-process (spirekeeper pattern), replacing the sketch stubs: - _sign_and_publish: sign as operator (resolve_signer), optional NIP-44 encrypt, publish via nostr_client.relay_manager.publish_message. Soft- fails (logs, returns None) if no operator onboarded, nostrclient absent, or signer can't encrypt — never crashes the booking flow. - publish_listing (30402) + publish_block_calendar (31923): public, work today (sign_event only). - publish_reservation (30078): NIP-44 encrypted to guest; soft-fails on a LocalSigner until a bunker/server-signing signer lands (lnbits#18). - subscribe_inbound: permanent task answering kind:22000 availability queries with kind:22001 (plaintext — availability is public info), the client-agnostic availability path parallel to the RPC. events.py: drop the _plaintext scaffolding (service.py encrypts content in place) and a broken {operator_pubkey} calendar tag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VUQCfdqiLSsFS2jcGnaFD