Skip to main content

Module seal

Module seal 

Source
Expand description

Sealing a record’s body (SPEC_USER_DATA_SYNC_LAYER §3.1). A body leaves a machine sealed with the collection’s key at the record’s key epoch: ChaCha20-Poly1305, with the collection id, record id, version, base version and key epoch as associated data, so a body cannot be replayed under another record, version, base or epoch, nor moved into another collection. The seal is the Vault’s (vault::sync_seal) under this module’s associated-data prefix, so there is one implementation. The layer treats a body as opaque bytes: the caller seals before a record is written (sealer with log::append_local_with) and opens after one is applied (open).

The ids in the associated data are letters, digits and ._- only (at most 128 characters): a collection or record id with anything else is refused, so no two places can have the same associated data.

Structs§

KeyRing
The keys a member holds for one collection, one per epoch it has been in, so it opens earlier records too.

Enums§

OpenError
Why a body would not open.

Constants§

AAD_PREFIX
The associated data’s first part for a Kanban board’s records.

Functions§

generate_key
A new random collection key, made on the machine that founds a collection or rotates it.
open
The body of a record, opened with the key its header’s epoch names. The header must be the verified one: its fields are the associated data, so a body altered, or moved to another record, version, base or epoch, fails.
seal
body sealed for the place at names, under the key the ring holds for that epoch.
sealer
For log::append_local_with: seals body under the ring’s key at the epoch the record will carry.