nfunc

v0.2.0

A small, private Nostr messenger, for a short list of keys you name yourself.

What it is

A desktop app for Apple, Linux and Windows. It sends and receives private messages between keys you have listed, from one or more identities of your own. It is deliberately not a social client: no feed, no timeline, no followers. Keeping to a short list of names is what keeps both the trust and the code small.

The stack

Tauri 2, React, Vite and Tailwind — the suite’s stack — with nostr-sdk for the protocol and keyring for the operating system’s key store. Encryption on the wire is rustls throughout, so there is no dependency on the system’s OpenSSL.

Get it

Version 0.2.0. Every release, and the source: GitHub.

Why gift wrap

An older Nostr direct message hides what is said and nothing else. Who sent it, who it is for and when are all public — and because the text is not padded, even its length tells something. A daily alert from a server can be read as “one problem” or “two problems” without ever being decrypted.

Gift wrap fixes that. The message is sealed and signed by you, then sealed again by a key used once and thrown away, with the time moved by up to two days. Someone watching sees an unknown key send something to your contact, at a time that is not the real one.

The three layers
LayerKindWhat it does
rumor14the message itself; never signed, never published on its own
seal13the rumor, encrypted to the receiver (NIP-44) and signed by the real sender
wrap1059the seal, encrypted again and signed by a throwaway key, its time moved by up to two days

Two things follow:

  • A conversation is put in order by the time inside the message, not the wrap’s, which is scrambled on purpose.
  • Wraps cannot be filtered by sender. nchat fetches every wrap addressed to you and tries to open each one.

Old-style messages are still read — never written — so correspondents who have not moved over, including the suite’s certificate and domain-expiry bots, keep working.

Keys

nchat is built on a web view, and a web view in a program that holds private keys is a real point of attack. The answer here is a hard boundary rather than a promise: your secret keys never reach the web view at all.

How the boundary holds
  • Secret keys go into the operating system’s key store and are read only inside Rust, for the moment it takes to sign or open a message.
  • No command the web view can call returns a secret key. It only ever sees public keys and the text of messages.
  • Messages are shown as text, never as markup, under a strict content policy.
  • Each identity is its own keypair, sharing one relay set and one contact list. A message is signed by, and opened for, exactly the identity you have chosen.
  • Linux — the Secret Service (libsecret)
  • macOS — the Keychain
  • Windows — Credential Manager

On Linux the key store needs a Secret Service running (GNOME Keyring or similar); nchat says so when it cannot reach one.

The whitelist

nchat shows messages from keys on your contact list and no others. Anything else is counted and dropped unread — the footer shows how many. Sending is bound to the list too, so a mistyped key cannot quietly become a message to a stranger.

Relay diagnostics

nping’s connect, subscribe and info checks are built in, and every message you send reports which relays took it. A relay that accepts the connection, advertises no restriction and then silently throws the message away is a real failure, and it has been seen. nchat shows it, instead of a cheerful “sent”.

How Nostr does it

Event kinds

  • kind:14 a private message, never published on its own (NIP-17)
  • kind:13 a seal: the message, encrypted and signed by the sender (NIP-59)
  • kind:1059 a gift wrap: the seal, sealed again by a throwaway key (NIP-59)
  • kind:4 a direct message, the old way (NIP-04) — read, never written

NIPs in play

  • NIP-17 private direct messages
  • NIP-59 gift wrap: the seal and the wrap
  • NIP-44 the encryption inside each layer
  • NIP-04 old-style messages — read only
  • NIP-11 the relay information check

Still to come