Expand description
Sendspin’s Noise layer: Noise_KKpsk2_25519_ChaChaPoly_SHA256.
Every Sendspin connection is wrapped in Noise. The handshake follows the cleartext init exchange and precedes all application traffic:
client -> server client/init cleartext JSON, carries the client_id
server -> client server/init cleartext JSON, carries the server_id
server -> client noise/handshake Noise message 1, payload {"psk_id": .., "psk_category": ..}
client -> server noise/handshake Noise message 2, payload {}The server is always the Noise initiator and the client the responder, whichever side opened
the WebSocket. Both static public keys are known before the handshake (KK), and the
pre-shared key is mixed in at the end of the second message (psk2). The Noise prologue is
the exact concatenation of the client/init and server/init bytes as sent on the wire, so
tampering with the cleartext exchange fails the handshake.
This module is the responder half plus the transport that follows the handshake. It does not
interpret handshake payloads; the session layer validates the psk_id/psk_category
metadata. This milestone uses the published Sentinel PSK, which is what an unpaired client
uses and which provides no authentication on its own; selecting a different PSK from message 1
arrives with the session layer.
Structs§
- Identity
- A long-lived X25519 keypair that identifies one side of a connection.
- Responder
- Noise responder state for one connection.
- Transport
State - A Noise transport session: one ciphertext per message.
Constants§
- MAX_
MESSAGE_ LEN - Maximum size of one Noise message, handshake or transport, including the authentication tag.
- MAX_
PLAINTEXT_ LEN - Largest plaintext that fits into one Noise transport message, including the leading binary message id byte.
- NOISE_
PARAMS - Noise protocol parameters used by Sendspin.
- SENTINEL_
PSK - The published Sentinel PSK, used whenever no paired PSK applies.
- SENTINEL_
PSK_ ID - The Sentinel PSK’s published id,
psk_id_for(SENTINEL_PSK). - TAG_LEN
- Length of the authentication tag appended to every Noise transport ciphertext.
Functions§
- psk_
id_ for - Derives a PSK id:
base64url(SHA-256("sendspin-psk-id-v1" || psk)), without padding.