Skip to content

v0.3.0 — NIP-46 remote signing

Choose a tag to compare

@sepehr-safari sepehr-safari released this 11 Jul 09:44
db437fa

Milestone A5 groundwork — the protocol layer a native signer needs: NIP-44 v2 encryption and the NIP-46 remote-signing ("bunker") protocol, so a signer can hold the user's key and sign for remote clients over a relay without the key ever reaching the client.

Highlights

NIP-44 v2 payload encryption (src/nip44.zig)

  • ChaCha20 + HMAC-SHA256 with HKDF-derived per-message keys over a libsecp256k1 ECDH shared secret, NIP-44 padding, and a constant-time MAC that fails closed.
  • Verified against the official NIP-44 test vectors — conversation keys, message keys, padding boundaries, and encrypt/decrypt round-trips.
  • Adds keys.Signer.sharedSecretX — raw-x ECDH via a custom libsecp256k1 hash callback (the ECDH module is now enabled in the pinned secp256k1 build).

NIP-46 remote signing (src/nip46.zig)

  • The request/response messages and their JSON, and the kind:24133 NIP-44 envelope (seal / open).
  • A transport-agnostic Bunker dispatcherconnect, sign_event, ping, get_public_key, nip44_encrypt, nip44_decrypt — behind an injectable approval Policy, keeping the connection key separate from the user key per spec.
  • bunker:// and nostrconnect:// connection URIs: parse and build with RFC 3986 percent-coding, verified against the spec's example token.

Relay I/O is deliberately left to the application — the library stays transport-agnostic; the native signer that wires this to a relay is being built in zig-nostr/signer.

Quality

  • 132 tests passing, CI green on Linux and macOS.
  • No hand-rolled cryptography: encryption binds to audited bitcoin-core/secp256k1 (compiled from a pinned source) and Zig std's ChaCha20/HMAC/HKDF, checked against the official spec vectors.
  • This release also brings CHANGELOG.md back in sync with every release tag (the [0.2.0] and [0.2.1] sections were back-filled).

Install

zig fetch --save https://github.com/zig-nostr/nostr/archive/refs/tags/v0.3.0.tar.gz

What's next

Milestone A5 continues in zig-nostr/signer: the relay listen/sign loop, NIP-49 encrypted key storage at rest, and a per-request approval flow, then a native macOS build.