Repository navigation
netcode 1.5.0 upgrades the wire protocol to NETCODE 1.03. Clients, servers and token-issuing backends must be upgraded together; 1.4.x and 1.5.0 peers do not interoperate.
In NETCODE 1.02, packets encrypted directly under the 32-byte client_to_server_key and server_to_client_key carried inside a connect token. That left two AEAD nonce-reuse paths within a connect token's lifetime: a client retrying an unfinished handshake with the same unexpired connect token while the server's history entry was still pending, and a connect token naming multiple freshly started servers that each began their global packet sequence at 2^63 under the shared server_to_client_key.
NETCODE 1.03 derives fresh 256-bit packet keys for every connection attempt with HChaCha20 (crypto_core_hchacha20) over client_salt[8] || server_nonce[8], so the keys inside a connect token never encrypt packets directly:
- The version info string in connect tokens, connection request packets and AEAD associated data is
"NETCODE 1.03\0"(13 bytes). - Connection request packets append an 8-byte random
client_salt(1086bytes total, up from1078), drawn fresh on everynetcode_client_connectcall and every failover to the next server address in the connect token. - Connection denied and connection challenge packets carry an 8-byte cleartext
server_nonceimmediately after the variable-length sequence number and include it in 30-byte AEAD associated data. Connection response, keep-alive, payload and disconnect packets keep their layout and 22-byte AEAD associated data unchanged. - Client: in
sending connection request, only connection denied and connection challenge packets are accepted; per-connection packet keys are locked in only once a connection challenge authenticates, a connection denied insending connection responsemust carry the recordedserver_nonce, and disconnect packets are sent only once connection keys exist. - Server: pending connect token history entries bind the 8-byte
client_saltin constant time and admit retransmissions from that address only withintimeout_secondsof creation; a valid disconnect packet on a half-open encryption mapping consumes its history entry and removes the mapping.