refactor: port the CLI off NDK and drop @nostr-dev-kit/ndk entirely #47

Merged
padreug merged 1 commit from fix/drop-ndk-cli into dev 2026-06-27 00:58:26 +00:00
Owner

The final NDK removal, following #45 (which made the daemon NDK-free). The standalone CLI (src/client.ts) was the last user of @nostr-dev-kit/ndk — a NIP-46 client (NDKNip46Signer). Porting it lets the dependency leave the repo completely.

What

  • src/nip46-client.ts (new) — a minimal NIP-46 client over the RelayPool, the inverse of the daemon's Nip46Transport: send requests to a remote signer, match responses by id, surface auth_url prompts; nip44 envelope. Methods: connect / signEvent / createAccount.
  • src/client.ts — rebuilt on it. npub / nip05 / bare-domain resolution via nostr-tools nip05.queryProfile + nip19; local client key stored as hex; events published through the pool. Dropped the now-unused websocket-polyfill import.
  • package.json + pnpm-lock.yaml@nostr-dev-kit/ndk removed, along with its now-orphaned transitive deps (446 lockfile deletions, reconciled via pnpm install --lockfile-only — no lockfile-format change).

Verification

  • grep -r @nostr-dev-kit/ndk srcempty.
  • All three bundles (index, daemon, client) build with 0 NDK references.
  • Tests: lifecycle 7 / relay 2 / nip46 1 / admin 2 green; tsc at the pre-existing baseline (3 unrelated authorize.ts / web/authorize.ts errors).

Note

The CLI is a debug/test tool and isn't covered by unit tests; the port mirrors the prior NIP-46 client behavior (connect → sign / create_account, with auth_url handling). The NIP-46 client logic is small and shares the same RelayPool + crypto as the daemon. Worth a quick smoke against a live bunker before relying on it, but it's not on any production path (lnbits is the real client).

With this merged, nsecbunkerd carries no NDK at all — the transport, daemon, and CLI are 100% nostr-tools.

Refs: #44, #45, #43, #42, #41

🤖 Generated with Claude Code

The final NDK removal, following #45 (which made the daemon NDK-free). The standalone CLI (`src/client.ts`) was the last user of `@nostr-dev-kit/ndk` — a NIP-46 **client** (`NDKNip46Signer`). Porting it lets the dependency leave the repo completely. ## What - **`src/nip46-client.ts`** (new) — a minimal NIP-46 *client* over the `RelayPool`, the inverse of the daemon's `Nip46Transport`: send requests to a remote signer, match responses by id, surface `auth_url` prompts; nip44 envelope. Methods: `connect` / `signEvent` / `createAccount`. - **`src/client.ts`** — rebuilt on it. npub / nip05 / bare-domain resolution via nostr-tools `nip05.queryProfile` + `nip19`; local client key stored as hex; events published through the pool. Dropped the now-unused `websocket-polyfill` import. - **`package.json` + `pnpm-lock.yaml`** — `@nostr-dev-kit/ndk` removed, along with its now-orphaned transitive deps (446 lockfile deletions, reconciled via `pnpm install --lockfile-only` — no lockfile-format change). ## Verification - `grep -r @nostr-dev-kit/ndk src` → **empty**. - All three bundles (`index`, `daemon`, `client`) build with **0 NDK references**. - Tests: `lifecycle 7 / relay 2 / nip46 1 / admin 2` green; `tsc` at the pre-existing baseline (3 unrelated `authorize.ts` / `web/authorize.ts` errors). ## Note The CLI is a debug/test tool and isn't covered by unit tests; the port mirrors the prior NIP-46 client behavior (connect → sign / create_account, with `auth_url` handling). The NIP-46 client logic is small and shares the same `RelayPool` + crypto as the daemon. Worth a quick smoke against a live bunker before relying on it, but it's not on any production path (lnbits is the real client). With this merged, **nsecbunkerd carries no NDK at all** — the transport, daemon, and CLI are 100% nostr-tools. Refs: #44, #45, #43, #42, #41 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor: port the CLI off NDK and drop @nostr-dev-kit/ndk entirely
Some checks failed
Docker image / build-and-push-image (push) Has been cancelled
8d56536d2d
Final NDK removal (follow-up to #44/#45). The standalone CLI (src/client.ts)
was the last NDK user — a NIP-46 *client* (NDKNip46Signer). Ported to a small
nostr-tools client so the dependency can leave the repo completely.

- src/nip46-client.ts — a minimal NIP-46 client over the RelayPool, the inverse
  of the daemon's Nip46Transport: send requests to a remote signer, match
  responses by id, surface auth_url prompts; nip44 envelope. Methods: connect /
  signEvent / createAccount.
- src/client.ts — rebuilt on it. nip05/npub/bare-domain resolution via
  nostr-tools nip05.queryProfile + nip19; local client key stored as hex;
  publish via the pool. Dropped the now-unused websocket-polyfill import.
- package.json + pnpm-lock.yaml — `@nostr-dev-kit/ndk` removed (and its orphaned
  transitive deps; lockfile reconciled with `pnpm install --lockfile-only`, no
  version-format change).

`grep -r @nostr-dev-kit/ndk src` is now empty; all three bundles (index, daemon,
client) build with 0 NDK references. Tests: lifecycle 7 / relay 2 / nip46 1 /
admin 2 green; tsc at the pre-existing baseline.

Refs: #44, #45, #43, #42, #41
padreug deleted branch fix/drop-ndk-cli 2026-06-27 00:58:26 +00:00
Sign in to join this conversation.
No reviewers
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!47
No description provided.