Migrate Nostr publishing off account.prvkey → use resolve_signer (pre-cascade prerequisite for lnbits#17) #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
nostr_hooks.pyreadsaccount.prvkeydirectly to sign event-related Nostr publications:aiolabs/lnbits#17(signer abstraction phase 1, PR open) ships anm002classify job that fail-closed NULLs theaccounts.prvkeycolumn for every row at startup. When that PR cascades to a host running this extension, allaccount.prvkeyreads returnNoneand Nostr publishing silently stops.Umbrella audit at
aiolabs/lnbits#21identifies this extension among 5 affected.Sites to migrate
nostr_hooks.py:18-36_resolve_keys-style helper → returnNostrSignerinstead of(pubkey, prvkey)publish_event(client, event, pubkey, prvkey, delete=…)is definedsigner: NostrSignerinstead of(pubkey, prvkey)Migration pattern
Replace the keypair helper with a signer-returning one:
Update the publisher to call
signer.sign_event(unsigned_dict)instead of doing its own Schnorr sign withcoincurve.PrivateKey(bytes.fromhex(prvkey)). The signer transparently handlesLocalSigner(decrypted envelope),ClientSideOnlySigner(raisesSignerUnavailableError), and (phase 2.3+)RemoteBunkerSigner.Acceptance
_resolve_signerreturningNostrSigner | Nonepublish_event(or equivalent) accepts aNostrSignerinstead of(pubkey, prvkey)events/post-migration: zeroaccount.prvkeyreferencespyproject.tomlversion to nextvX.Y.Z-aio.Nper the fork-versioning convention (this extension is already onv1.3.0-aio.2per the catalog — next would bev1.3.0-aio.3)aiolabs/lnbits-extensions/extensions.json(new entry alongside the previous, don't overwrite — operators on older versions need the previous to still resolve)Timing
Blocks
aiolabs/lnbits#17's cascade to any host running the events extension. Events is actively used onaio-demo; this is the highest-priority of the three new issues filed today (restaurant + tasks + events) because it has the closest production exposure.Cross-references
aiolabs/lnbits#21— umbrella audit (this is one of 5 affected extensions)aiolabs/lnbits#17— the cascading PR whose m002 NULLsaccounts.prvkeyaiolabs/lnbits#9— parent: operator-IdP framing, signer abstractionaiolabs/restaurant#<TBD>+aiolabs/tasks#<TBD>— sister migrations (filed in parallel)~/dev/coordination/log.md2026-05-26T19:30Z — cross-session coordination entryUpdate 2026-05-27 — async sign_event API confirmed via
aiolabs/lnbits#24NostrSigner.sign_eventis migrating toasync definaiolabs/lnbits#24(open, stacked on PR #19). When that lands, the canonical migration pattern becomes:Two notes:
resolve_for_wallet(wallet_id)(lands inaiolabs/lnbits#23) collapses the entire_resolve_keysblock into one call.await signer.sign_event(event)works for all three concrete signers; sync impls expose async signature for ABC consistency. Zero runtime cost onLocalSigner.Extension-local Schnorr signing code (
coincurve.PrivateKey(bytes.fromhex(prvkey))+ Schnorr sign) can be removed — signer handles it.Acceptance items remain the same. This is the highest-priority of the three new prvkey-migration issues since events runs on
aio-demo; the await form lets you ship migration once the lnbits side cascades.