Skip to content

NIP-46: unknown/unsupported methods (e.g. logout) get no reply #27

Description

@SovereignTechnology

NIP-46 requests whose method is not in Nip46Method (packages/shared-types/src/nip46.ts), or whose params aren't all strings, fail Nip46RequestSchema.safeParse in bunker.service.ts. The service logs Invalid NIP-46 request schema and returns without sending anything. The client waits until its own timeout.

Two spec points make this user-visible:

  • logout was added to NIP-46 on 2026-06-14 (nips a932d69). It takes params [] and returns "ack". On receipt the signer SHOULD remove the session for that client-pubkey. nostr-tools' BunkerSigner now calls it (nip46.ts: sendRequest('logout', [])), so logging out of a nostr-tools-based client currently hangs.
  • NIP-46 also now says: "Requests made with unknown or unsupported methods MUST be replied with an error" (46.md, nips f0af204, 2026-07-15, "Avoid nip46 silent timeouts"). The handler's default: branch, which would do exactly that, can't be reached, because the schema rejects the request first.

Suggested fix:

  • Accept any method string at the schema level, and let the handler's default: reply { id, error: 'unsupported method: <m>' }.
  • Implement logout: reply "ack", then revoke or remove the connection for that client-pubkey.

Related: the REVOKED branch in the handler also looks unreachable, because findByClientAndSigner only returns ACTIVE/PENDING rows. A revoked client therefore gets "Unknown client" instead of the revoked path.

(Found while working on #26.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions