Expand description
Replica encryption at rest (SPEC-ENGINE §3.4.2).
Every text column of a replica is XChaCha20-Poly1305 ciphertext under
the place’s replica key rk (32 random bytes), with AAD
place_id|table|row_key|column and a random 24-byte nonce per value.
rk is stored wrapped by the machine’s replica master key mk; mk
lives in the OS keychain (service lean-ctx-cloud, account
replica-master) or, without one, in <config>/cloud/replica.key
(0600, reported as at_rest: file key). LEAN_CTX_REPLICA_KEY_FILE
forces the file path (tests, staging builds: no keychain dialogs).
Enums§
- AtRest
- Where
mkis kept.
Functions§
- aad
- The AAD of one column value.
- key_
file - The file
mkis kept in without a keychain. - master_
key - The machine’s replica master key
mkand where it is kept. The keychain is used unlessLEAN_CTX_REPLICA_KEY_FILEis set, the platform has none, orkeychain_requiredis false and the keychain fails;keychain_required(workspace policyrequire_keychain_at_rest) refuses the file fallback. - new_
replica_ key - A fresh per-place replica key.
- open
- Decrypt what
sealmade; fails on another key, AAD or a changed byte. - seal
- Encrypt
plainunderkeybound toaad:nonce ‖ ciphertext. - unwrap
- Unwrap a stored
rk;Nonewhenmkdoes not open it (replica_key_missing: the place is re-cloned). - wrap
- Wrap
rkfor storage undermk.
Type Aliases§
- Key
- A 32-byte key that is wiped on drop.