Expand description
Payload serialization, compression, and file embedding.
The payload format wraps the plaintext before encryption:
[1 byte ] flags
[M bytes] inner payload (raw or Brotli-compressed depending on flags)The inner payload (after decompression) uses a 0x00 separator:
[text bytes] UTF-8 message (may be empty)
[0x00] separator (only present if files follow)
[file entry]* zero or more file entriesFile entry format:
[1 byte ] filename_len (1–255)
[N bytes] filename (UTF-8)
[4 bytes] content_len (u32 BE)
[M bytes] file contentStructs§
- File
Entry - A file entry embedded in the payload.
- Payload
Data - Decoded payload containing text and optional files.
Constants§
- MAX_
RAW_ FILE_ SIZE - Maximum raw file size before compression (hard reject).
Functions§
- compressed_
payload_ size - Compute the compressed payload size (in bytes) for the given text and files.
- decode_
payload - Decode a payload from decrypted bytes.
- encode_
payload - Encode a payload (text + optional files) into bytes ready for encryption.