refactor: remove @nostr-dev-kit/ndk from the daemon entirely (#44) #45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/44-remove-ndk"
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?
Follow-up to #43 (the transport swap). NDK no longer touched the relay/reconnect path, but it lingered in non-transport helpers; this removes it from the daemon completely. The daemon and main-entry bundles now contain zero
@nostr-dev-kit/ndkreferences. Implements #44.Ported to nostr-tools
run.tsgetKeysNDKPrivateKeySigner(nsec).user().npubgetPublicKey(secretKeyBytes) → nip19.npubEncodeadmin/commands/create_new_key.tsNDKPrivateKeySignergenerate/import/existinggenerateSecretKey/getPublicKey/nip19admin/commands/create_account.tsNDKPrivateKeySigner.generate()+NDKUserProfilegenerateSecretKey+ localSkeletonProfilelib/profile.tsfinalizeEvent+ throwawayRelayPooladmin/index.ts+utils/dm-user.tsfinalizeEvent+RelayPoolcommands/start.tsNDKUser.fromNip05finalizeEvent+RelayPool+nip05.queryProfileconfig/index.tsNDKPrivateKeySigner.generate()default keygenerateSecretKey+ hexacl/index.ts,authorize.tsNostrEvent/NIP46Method/Hexpubkey)Event/ local types /stringFor the NIP-89 announcement I dropped the fetch-existing-d-tag step: this code always uses the default
d="24133", so re-publishing replaces the same addressable (kind, author, d) event — identical effect, no read needed.Latent bug fixed (surfaced by the type change)
authorize.ts'srequestAuthorizationcalledparam.rawEvent(), but since #43 the signer passes a plain event object (no.rawEvent). The oldNDKEventtype hid it; nostr-tools'Eventtype caught it. Asign_eventapproval would have recorded"[object Object]"as the request params — now itJSON.stringifys the event.Scope
@nostr-dev-kit/ndkremains inpackage.jsonfor one thing only: the standalone CLIsrc/client.ts— a NIP-46 client (the inverse component), not part of the daemon runtime. This matches #44's carve-out ("CLI may be handled separately"). Porting the CLI to a nostr-tools NIP-46 client (and dropping the npm dependency entirely) can be a small follow-up if wanted.Tests
lifecycle 7 / relay 2 / nip46 1 / admin 2green; daemon + main bundles verified NDK-free (grep nostr-dev-kit … = 0);tscat the pre-existing baseline (3 unrelatedauthorize.ts/web/authorize.tserrors, untouched). The key-gen / profile / boot-DM / NIP-89 paths aren't unit-tested (no behavior change intended; they mirror the prior NDK logic).Refs: #44, #43, #42, #41
🤖 Generated with Claude Code