Skip to main content

Module encryption

Module encryption 

Source

Structs§

EncryptionService
Manages encryption keys and provides XChaCha20-Poly1305 encryption/decryption
KeyFingerprint
Stable wire identity of one 32-byte encryption key: its full SHA-256 digest, serialized as exactly 64 lowercase hex digits.
KeyFingerprintParseError
KeyTag
The cleartext prefix every sealed payload carries ahead of its ciphertext, naming the key it is under:
MasterKeyring
A store’s master key material: every key it holds. This is the value custody implementations store, unlock, and re-protect — never a cipher. coven builds the EncryptionService cipher from it internally; custody never touches cipher machinery.
SealedBlobHeader
What a sealed payload’s header says about its own layout: where its base nonce comes from, the chunk size it was sealed at, and the plaintext length it covers. Every other offset in the object is arithmetic over those, so a payload describes its own shape and nothing per-chunk is stored.
SealedBlobOpener
Opens a sealed blob’s chunks in any order. A chunk that opens is authentic — the tag covers its bytes, its position, and the header that framed it — so decryption is the whole verification and no separate hash is read.
SealedBlobSealer
Seals one blob’s chunks in order, so an upload streams without ever holding the whole plaintext or ciphertext. The header it emits first is what a later read needs to compute every chunk offset.

Enums§

EncryptionError
KeyTagError
What a stored payload’s leading key tag can fail to be.
NoncePolicy
Where a sealed payload’s base nonce comes from — the choice every caller that seals or opens one states outright.
SealError
Why sealing or opening a host’s app-data failed.
SealedBlobError
Why a sealed blob’s header or one of its chunks could not be opened.

Constants§

CHUNK_SIZE
64KB plaintext chunks
DEFAULT_BLOB_CHUNK_SIZE
The chunk size a blob is sealed at when the host configures none. A read honors whatever its own header records, so this is only ever the writer’s choice and can change without touching a blob already stored.
INITIAL_KEY_GENERATION
SEALED_BLOB_HEADER_LEN
[version: 1][nonce policy: 1][chunk_size: 4 LE][plaintext_len: 8 LE] — the fixed part of the header every sealed payload carries ahead of its first chunk. A payload under NoncePolicy::RandomStored follows it with the 24-byte base nonce; SealedBlobHeader::prefix_len is the whole of it either way.
TAG_SIZE
Poly1305 auth tag size (16 bytes).

Functions§

chunked_encrypted_len
The sealed length of a whole-object payload of plaintext_len bytes — what a streaming upload declares before a byte is sealed.
generate_random_key
Generate a random 32-byte key.