feat(pairing): slim the spire seed + carry lnbits_npub (bitspire-#70) #37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bitspire-70-seed-lnbits-npub"
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?
What
Mints the new-shape
spire-seedthe bitSpire consumer now expects (aiolabs/bitspire#70). Two goals:spire_npub+spire_pubkeyhex + inside a fullbunker_url). Now it rides once, asspire_npub; the consumer derives the hex and reconstructsbunker_urlfrombunker_secret+bunker_relay/relays[0]. ~a third smaller encoded — real headroom for a QR that's already hard to scan off the machine's camera.lnbits_npub(this LNbits' nostr-transport server identity), so a paired ATM reaches the backend with nothing else provisioned — noVITE_LNBITS_SERVER_PUBKEY/VITE_RELAY_URLin.env.Changes
build_seed_urlemits{v, spire_npub, lnbits_npub, bunker_secret, relays}, plusbunker_relayonly when it differs fromrelays[0](omitted in the common case). Dropsspire_pubkeyand the fullbunker_urlfrom the payload.pair_spirereadssettings.nostr_transport_public_key,hex_to_npubs it intolnbits_npub, and raisesPairingErrorwhen it's empty (transport not running → can't mint a self-sufficient seed).bunker_urlis still returned inPairResultfor operator display / audit — only the seed stops embedding it.Kept as
v: 1(redefined in place; no shipped seed to preserve — one-shot tokens, no prod bitSpire machines, and a paired machine resumes from its stored binding, not by re-parsing the seed).Wire shape
Tests
test_pairing.pyupdated to the new shape: seed-contract decode,build_seed_urlround-trip, default-bunker_relayomission, and missing-transport-pubkey →PairingError. A transport-pubkey fixture setssettings.nostr_transport_public_key.main(stalefake_pairmissing thebunker_relayparam; unmockedget_super_configDB read) — unrelated to #70 but they made the suite red.Consumer side (lockstep)
Merged on
aiolabs/bitspiredev(the parser slim + machine wiring is queued behind this):packages/nostr-client/src/seed.tsderives hex from npub + reconstructsbunker_url, and the machine sources relay(s) + server pubkey from the pairing. This PR must merge before a new-shape seed is minted in prod.Rollout
Merge here → bump
aiolabs/lnbits-extensionscatalog (spirekeeper entry) → push bitspiredev+ cache → re-pair the Sintra with a freshly-minted seed to verify blank-.env→ wizard → paired → backend end-to-end.🤖 Generated with Claude Code
Mint the new-shape seed the bitspire consumer now expects: the pubkey rides once as spire_npub (consumer derives the hex + reconstructs bunker_url from bunker_secret + bunker_relay|relays[0]), and lnbits_npub is embedded so a paired machine reaches this lnbits' nostr-transport with nothing else provisioned. - build_seed_url emits {spire_npub, lnbits_npub, bunker_secret, relays} and bunker_relay only when it differs from relays[0] (omitted in the common case). Drops spire_pubkey + the full bunker_url from the payload. - pair_spire reads settings.nostr_transport_public_key, hex_to_npub's it, and raises PairingError when it's empty (transport not running → can't mint a self-sufficient seed). bunker_url is still returned in PairResult for operator display / audit; only the seed stops embedding it. Consumer side: bitspire packages/nostr-client/src/seed.ts + the #70 machine wiring. Kept as v: 1 (redefined in place; no shipped seed to preserve). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>The nostrclient endpoint is a subscription MULTIPLEXER, not a full relay: its router forwards a client's EVENT upstream but never returns an OK ack (see nostrclient/router.py). A transport client that awaits OK on publish therefore times out ("publish timed out"), so kind-21000 RPCs never complete — verified on the Sintra: connect succeeded but list_wallets hung, and switching to the nostrrelay endpoint made the whole flow work (wallet, balance, availability). default_relay_endpoint now derives from settings.nostr_transport_relays — the relay the transport actually listens on: use it as-is when already machine-reachable, or re-home its path on lnbits_baseurl when it's a co-located loopback relay (the bundled nostrrelay). Validation/localhost-reject and the pair-dialog pre-fill/hint carry over; wording updated to "transport relay". 227 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>