pub const MAX_ENVELOPE_SIZE: usize = 65507;
Expand description

Envelopes are versioned

These are the formats for the on-the-wire serialization performed by this module

#[repr(C, packed)] struct EnvelopeHeader { // Size is at least 4 bytes. Depending on the version specified, the size may vary and should be case to the appropriate struct magic: [u8; 3], // 0x00: 0x56 0x4C 0x44 (“VLD”) version: u8, // 0x03: 0 = EnvelopeV0 }

#[repr(C, packed)] struct EnvelopeV0 { // Size is 106 bytes without signature and 170 with signature magic: [u8; 3], // 0x00: 0x56 0x4C 0x44 (“VLD”) version: u8, // 0x03: 0 = EnvelopeV0 crypto_kind: [u8; 4], // 0x04: CryptoSystemVersion FOURCC code (CryptoKind) size: u16, // 0x08: Total size of the envelope including the encrypted operations message. Maximum size is 65,507 bytes, which is the data size limit for a single UDP message on IPv4. timestamp: u64, // 0x0A: Duration since UNIX_EPOCH in microseconds when this message is sent. Messages older than 10 seconds are dropped. nonce: [u8; 24], // 0x12: Random nonce for replay protection and for dh sender_id: [u8; 32], // 0x2A: Node ID of the message source, which is the public key of the sender (must be verified with find_node if this is a new node_id/address combination) recipient_id: [u8; 32], // 0x4A: Node ID of the intended recipient, which is the public key of the recipient (must be the receiving node, or a relay lease holder) // 0x6A: message is appended (operations) signature: [u8; 64], // 0x?? (end-0x40): Signature of the entire envelope including header is appended to the packet // entire header needs to be included in message digest, relays are not allowed to modify the envelope without invalidating the signature. }