Menu 0.6.0 preview

Reference

Agent Docs: Protocol and wire format

NK Pattern

Noise_NK_25519_ChaChaPoly_BLAKE2s is a two-message handshake in which the initiator already knows the responder’s static key and sends no static key of its own. TrueSeal uses it for Push Sessions, the short connections a device opens to hand messages to the relay.

In TrueSeal

The device is the initiator. It takes the relay’s static key from its Relay Address, so the handshake completes only with that relay. The device sends only a fresh ephemeral key, made for this session and thrown away after it.

The handshake therefore gives the relay no key that belongs to the device, and no key that links one Push Session to another or to the device’s Receive Session. The relay can still often link them by the timing of the connections, and the server it runs on also sees their IP addresses. The messages themselves carry no sender key in plaintext either. Envelopes and Blobs lists what the relay can read.

API

// Initiator: must already hold the responder's static public key
let session = session_nk::dial(conn, keypair, remote_static)?;

// Responder
let session = session_nk::accept(conn, keypair)?;

// Both sides
session.send(b"hello")?;
let msg = session.receive()?;
session.close()?;

session_nk::Session has no remote_public_key(). The initiator passed the responder’s key in, and the responder never receives one from the initiator, so there is nothing to return. The method is missing from the type, so a caller can’t call it by mistake.

The pattern itself is defined in the Noise specification, and trueseal-noise’s tests check this cipher suite against one NK vector from the cacophony set.