All files in the repository follow a specific structure for versioning and security. Every file starts with a version byte (currently 0x02), followed by an encrypted and authenticated Tink payload.
Payload Structure
When the payload is decrypted, the first four bytes represent the compressed plaintext size as a signed 32-bit integer. This indicates where the compressed data ends and padding begins.
Format Diagram:
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃ encrypted tink payload (with 40 bytes header) ┃
┃ version ┃ ┏━ plaintext ━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃
┃ 1 byte ┃ ┃ size uint32 ┃ compressed ┃ padding ┃ ┃
┃ (0x02) ┃ ┃ 4 bytes ┃ plaintext ┃ (optional) ┃ ┃
┃ ┃ ┗━━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━━┛ ┃
┗━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
- Compression: Uses the
zstd algorithm in its default configuration. - Blob Payloads: Include raw bytes of compressed chunks and are always padded.
- Snapshot Payloads: Include compressed protobuf encoding and are not padded.