pub const MAX_RECEIPT_SIZE: usize = 1380;
Expand description

Out-of-band receipts are versioned along with envelope versions

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

#[repr(C, packed)] struct ReceiptHeader { // 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: 0x52 0x43 0x50 (“RCP”) version: u8, // 0x03: 0 = ReceiptV0 }

#[repr(C, packed)] struct ReceiptV0 { // Size is 66 bytes without extra data and signature, 130 with signature magic: [u8; 3], // 0x00: 0x52 0x43 0x50 (“RCP”) version: u8, // 0x03: 0 = ReceiptV0 crypto_kind: [u8; 4], // 0x04: CryptoSystemVersion FOURCC code size: u16, // 0x08: Total size of the receipt including the extra data and the signature. Maximum size is 1380 bytes. nonce: [u8; 24], // 0x0A: Randomly chosen bytes that represent a unique receipt. Could be used to encrypt the extra data, but it’s not required. sender_id: [u8; 32], // 0x22: Node ID of the message source, which is the public key of the sender extra_data: [u8; ??], // 0x42: Extra data is appended (arbitrary extra data, not encrypted by receipt itself, maximum size is 1250 bytes) signature: [u8; 64], // 0x?? (end-0x40): Signature of the entire receipt including header and extra data is appended to the packet }