Bump @nostr-dev-kit/ndk 2.8.1 → 3.0.3 — unlocks nip44 backend + 2yr of upstream #14
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?
Why
Diagnosed against
dev@f2a9697on 2026-05-31 (see coord log2026-05-31T08:35Z). Two coupled gaps in our NDK pin block the encrypt/decrypt path through nsecbunkerd:Finding 1 — NDK 2.8.1 has no
nip44_encrypt/nip44_decryptbackend handlers.NDKNip46Backend.handlersin our pinnednode_modules/.../@nostr-dev-kit/ndk@2.8.1/.../signers/nip46/backend/index.ts:119registers onlyconnect, sign_event, nip04_encrypt, nip04_decrypt, get_public_key, ping. When a wire RPC arrives withmethod: "nip44_decrypt"(the call shape lnbits'sRemoteBunkerSignernow uses post-aiolabs/lnbits#38), dispatch falls through tosendResponse(id, remotePubkey, "error", undefined, "Not authorized")atbackend/index.ts:179. lnbits maps that toNsecBunkerRpcError— terminal, non-retry-eligible.Finding 2 — even nip04 is silently broken: NDK 2.8.1 normalizes the wire method to
encrypt/decryptbefore callingpubkeyAllowed, while lnbits's policy stores wire names.Nip04EncryptHandlingStrategy.encrypt()in 2.8.1 callsbackend.pubkeyAllowed({ method: "encrypt", ... }). Upstream NDK (post-Oct 2025) passes the wire name verbatim. lnbits's_ensure_policystores rules asnip04_encrypt/nip04_decrypt/nip44_encrypt/nip44_decrypt. Confirmed viasqlite3 ~/dev/local/docker/regtest/data/nsecbunker/nsecbunker.db 'SELECT method FROM PolicyRule'— 4 kind-less rules, all wire-named. With NDK 2.8.1 the auth check atsrc/daemon/lib/acl/index.tsreceivesmethod='encrypt'and finds zero matchingPolicyRulerows → falls torequestAuthorization()→ 15s timeout. So the encrypt/decrypt path through nsecbunkerd has never actually worked end-to-end; it just hadn't been exercised until phase 2.4 landed.Fix
Pin
@nostr-dev-kit/ndkto3.0.3(the currentlatestdist-tag, published 2026-02-23, stable for 3 months).What this gets us beyond the immediate fix
nip44_encrypt/nip44_decryptbackend handlers registered by defaultswitch_relaysNIP-46 support for client-side relay migrationdeb7f93d)#7)@noble/*crypto primitivesWhy 3.0.3 (and not 2.15.0, 2.18.0, beta, or HEAD)
2.8.1(current)2.15.0344c313fOct 8 2025)2.18.03.0.0-beta.X4b86acd1)3.0.3latestdist-tag, 3 months stableMigration surface (verified by reading NDK 3.x source at
~/dev/refs/repos/nostr/nostr-dev-kit/ndk)Our usage maps cleanly onto NDK 3.x without API breakage. Only meaningful code change is in
src/daemon/lib/acl/index.ts:IMethodtype: widen fromconnect | sign_event | encrypt | decrypt | pingto include the new wire names (nip04_encrypt,nip04_decrypt,nip44_encrypt,nip44_decrypt,switch_relays).requestToSigningConditionQuery: update theswitchto handle the new method names instead of the old normalized ones.allowScopeToSigningConditionQuery: follow.Once those align with the wire-name convention, the post-
#11live-policy join (step 4 ofcheckIfPubkeyAllowed) naturally matches lnbits's existingnip04_encrypt/nip44_decryptpolicy rules — no further changes needed on lnbits's side.applyTokenfan-out atsrc/daemon/backend/index.ts:97-112and the permit callback atsrc/daemon/run.ts:101need no changes — they passrule.methodandparams.methodthrough verbatim.Plan
Single branch off
dev, four commits:chore(deps): bump @nostr-dev-kit/ndk 2.8.1 → 3.0.3—package.json+ regeneratedpnpm-lock.yaml.refactor(acl): align method-name convention with NDK 3.x wire-name semantics—IMethod+requestToSigningConditionQuery+allowScopeToSigningConditionQuery.fix(nix): adapt package derivation to NDK 3.x dep tree(only if needed — flake.lock / package.nix tweaks discovered during build).Test plan
pnpm installclean (no peer-dep warnings introduced);pnpm run buildgreen.docker compose build --no-cache nsecbunker && docker compose up -d nsecbunker). Wait for satmachineadmin's next consumer poll. Verify Greg's pending v1.1 cassette-state event decrypts successfully (kind-30078 NIP-44 ciphertext from bitspire's Sintra).cassette_configs.state_event_idadvances pastf46b6dcf62f6...to the new v1.1 event ID.aiolabs/nsecbunkerd#11regression: re-run the 8 live-policy auth cases on the bumped branch — they should pass identically since theacl/index.tsrewrite remains conceptually the same, just with widened method-name vocabulary.Carries forward
Open question parked in coord log
2026-05-31T08:35Z: bunker boots with🔑 Starting keys []. By design (only un-encrypted keys are auto-loaded; encrypted keys load as locked and unlock via admin RPC). Not blocking this bump but flagged for awareness in case Greg'sbunker_namekey needs to be unlocked before the smoke succeeds.refs: coord log 2026-05-31T08:35Z (the diagnosis), aiolabs/lnbits PR #38 (the phase-2.4 surface that surfaced this), aiolabs/satmachineadmin PR #30 (the consumer migration), NDK CHANGELOG
~/dev/refs/repos/nostr/nostr-dev-kit/ndk/core/CHANGELOG.md, NDK MIGRATION~/dev/refs/repos/nostr/nostr-dev-kit/ndk/core/MIGRATION-2.16.md