Remove @nostr-dev-kit/ndk from the daemon entirely (follow-up to #43) #44

Closed
opened 2026-06-26 23:55:49 +00:00 by padreug · 1 comment
Owner

#43 swapped the relay transport off NDK onto nostr-tools, fixing #41. NDK no longer touches the relay/reconnect path, but it remains in a handful of non-transport daemon helpers. This issue tracks removing @nostr-dev-kit/ndk from the daemon completely.

Residual NDK usages (all non-transport)

File Usage Port to
admin/commands/create_new_key.ts NDKPrivateKeySigner (key generation), NDKEvent generateSecretKey / getPublicKey / nip19; finalizeEvent
admin/commands/create_account.ts NDKPrivateKeySigner, Hexpubkey/NDKUserProfile types nostr-tools + local types
lib/profile.ts (setupSkeletonProfile) NDK + NDKEvent + NDKPrivateKeySigner (publishes a kind:0 profile) publish via a throwaway RelayPool + finalizeEvent
admin/index.ts (notifyAdminsOfNewConnection) throwaway NDK + dmUser for the one-shot boot DM port utils/dm-user.ts to nip04 + finalizeEvent, publish via a short-lived RelayPool
utils/dm-user.ts NDK/NDKEvent/NDKUser kind:4 DM nostr-tools
run.ts (getKeys) new NDKPrivateKeySigner(nsec).user() → npub getPublicKey(secretKeyBytes(nsec)) + nip19.npubEncode
lib/acl/index.ts import type { NostrEvent, NIP46Method } Event from nostr-tools; NIP46Method from nip46/types.ts
authorize.ts import { Hexpubkey, NDKEvent, NostrEvent } types nostr-tools / local
src/client.ts the standalone CLI (NDKNip46Signer) optional — could stay on NDK or use nostr-tools nip46 client; not part of the daemon

Acceptance

  • grep -r '@nostr-dev-kit/ndk' src/daemon returns nothing (CLI src/client.ts may be handled separately).
  • @nostr-dev-kit/ndk dropped from package.json dependencies (or moved to whatever the CLI needs).
  • All suites green (test:all), daemon bundles, no behavior change to key creation / account creation / boot DM.

Lower priority than #43 — none of this is load-bearing for the #41 fix; it's cleanup so the daemon stops carrying NDK + its transitive weight.

Refs: #43, #42, #41.

#43 swapped the relay **transport** off NDK onto nostr-tools, fixing #41. NDK no longer touches the relay/reconnect path, but it remains in a handful of **non-transport** daemon helpers. This issue tracks removing `@nostr-dev-kit/ndk` from the daemon completely. ## Residual NDK usages (all non-transport) | File | Usage | Port to | |---|---|---| | `admin/commands/create_new_key.ts` | `NDKPrivateKeySigner` (key generation), `NDKEvent` | `generateSecretKey` / `getPublicKey` / `nip19`; `finalizeEvent` | | `admin/commands/create_account.ts` | `NDKPrivateKeySigner`, `Hexpubkey`/`NDKUserProfile` types | nostr-tools + local types | | `lib/profile.ts` (`setupSkeletonProfile`) | `NDK` + `NDKEvent` + `NDKPrivateKeySigner` (publishes a kind:0 profile) | publish via a throwaway `RelayPool` + `finalizeEvent` | | `admin/index.ts` (`notifyAdminsOfNewConnection`) | throwaway `NDK` + `dmUser` for the one-shot boot DM | port `utils/dm-user.ts` to nip04 + `finalizeEvent`, publish via a short-lived `RelayPool` | | `utils/dm-user.ts` | `NDK`/`NDKEvent`/`NDKUser` kind:4 DM | nostr-tools | | `run.ts` (`getKeys`) | `new NDKPrivateKeySigner(nsec).user()` → npub | `getPublicKey(secretKeyBytes(nsec))` + `nip19.npubEncode` | | `lib/acl/index.ts` | `import type { NostrEvent, NIP46Method }` | `Event` from nostr-tools; `NIP46Method` from `nip46/types.ts` | | `authorize.ts` | `import { Hexpubkey, NDKEvent, NostrEvent }` types | nostr-tools / local | | `src/client.ts` | the standalone CLI (`NDKNip46Signer`) | optional — could stay on NDK or use `nostr-tools` nip46 client; not part of the daemon | ## Acceptance - `grep -r '@nostr-dev-kit/ndk' src/daemon` returns nothing (CLI `src/client.ts` may be handled separately). - `@nostr-dev-kit/ndk` dropped from `package.json` dependencies (or moved to whatever the CLI needs). - All suites green (`test:all`), daemon bundles, no behavior change to key creation / account creation / boot DM. Lower priority than #43 — none of this is load-bearing for the #41 fix; it's cleanup so the daemon stops carrying NDK + its transitive weight. Refs: #43, #42, #41.
Author
Owner

Done. NDK was removed from the daemon in #45 (fix/44-remove-ndk) — key-gen, profile.ts, boot DM (dm-user.ts → nip04 + RelayPool), the NIP-89 announcement, getKeys, and the ACL/type imports all ported to nostr-tools; daemon + main bundles verified 0 NDK refs. The final removal — the standalone CLI ported to src/nip46-client.ts and @nostr-dev-kit/ndk dropped from package.json + pnpm-lock.yaml — landed in #47.

nsecbunkerd now carries zero NDK across transport, daemon, and CLI. Both merged to dev and running on aio-demo since 2026-06-27.

Closing as resolved.

Done. NDK was removed from the daemon in **#45** (`fix/44-remove-ndk`) — key-gen, `profile.ts`, boot DM (`dm-user.ts` → nip04 + RelayPool), the NIP-89 announcement, `getKeys`, and the ACL/type imports all ported to nostr-tools; daemon + main bundles verified 0 NDK refs. The final removal — the standalone CLI ported to `src/nip46-client.ts` and `@nostr-dev-kit/ndk` dropped from `package.json` + `pnpm-lock.yaml` — landed in **#47**. nsecbunkerd now carries **zero NDK** across transport, daemon, and CLI. Both merged to `dev` and running on aio-demo since 2026-06-27. Closing as resolved.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/nsecbunkerd#44
No description provided.