Migrate Nostr publishing off account.prvkey → use resolve_signer (pre-cascade prerequisite for lnbits#17) #3
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 task / completion / deletion events: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-29_resolve_keyshelper (rename →_resolve_signer, returnNostrSigner)nostr_hooks.py:45-48(pubkey, prvkey) = keys; publish_task_event(...)nostr_hooks.py:70-73nostr_hooks.py:91-94nostr_publisher.py:141, 154, 171, 180, 196, …account_prvkey: strand pass it tosign_nostr_eventMigration pattern
Replace the keypair helper with a signer-returning one:
Threaded through
nostr_publisher.py— each inner helper that takesaccount_prvkey: strswitches tosigner: NostrSignerand callssigner.sign_event(unsigned_dict)to populate the event'sid+pubkey+sig.Builders should produce an unsigned dict (kind / created_at / tags / content) and let the signer fill in
id+pubkey+sig. The currentsign_nostr_eventextension-local helper becomes unnecessary.Acceptance
_resolve_keysremoved;_resolve_signerreturnsNostrSigner | Noneaccount_prvkeyparameter removed from allnostr_publisher.pyfunctions; replaced withsigner: NostrSignersign_nostr_eventextension-local helper removed (signer handles it)nostr_hooks.pyupdated (task publish, completion publish, completion delete)tasks/post-migration: zeroaccount.prvkeyreferencespyproject.tomlversion to nextvX.Y.Z-aio.Nper the fork-versioning conventionaiolabs/lnbits-extensions/extensions.json(new entry alongside the previous)Timing
Blocks
aiolabs/lnbits#17's cascade to any host running the tasks extension. Currently no production host runs tasks; landing this before PR #17 cascades to dev-tier hosts is the conservative call.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>— sister migration for the same pattern (filed in parallel)aiolabs/events#<TBD>— sister migration~/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_keyshelper into one call.await signer.sign_event(event)works for all three concrete signers;LocalSignerandClientSideOnlySignerare sync in body but expose async signature for ABC consistency. Zero runtime cost.sign_nostr_eventextension-local helper can be removed — signer handles it.Acceptance items remain the same; write the await form from day one.