Skip to main content

Module at_rest

Module at_rest 

Source
Expand description

At-rest keyring — Q39 slice A: wrapped galaxy DEKs in a keyring DBI.

One root key (RK) per store; one random 256-bit data-encryption key (DEK) per galaxy, wrapped by KEK = hkdf32(rk, "wm/galaxy-dek/v1/<galaxy>") with XChaCha20-Poly1305 and the same info string as AAD (so a wrapped DEK cannot be transplanted between galaxies). A rk:check row (AEAD wrap of a fixed known plaintext under RK) is the wrong-key discriminator, written in the same transaction as the DEKs.

Slice A records remain plaintext. This module lands the key hierarchy and the open-time unlock path; record AEAD is slice B. Mode B (key file) never advertises crypto-erasure — its guarantee is physical purge only.

Design: docs/Q39_CRYPTO_ERASURE_DESIGN.md §2/§3/§7.

Layout decisions:

  • The generated key file lives at the store root, next to the seal key: when the open path’s final component is lmdb (the standard <store-root>/lmdb layout) the key is <store-root>/.at_rest_key; other layouts (tests, custom paths) keep it inside the directory passed to the store open. The key therefore lives outside the directory that LMDB maintenance/restore tooling rewrites hardest.
  • The keyring DBI is not part of the store’s required schema: legacy stores and strict read-only opens never create it, and ensure_schema leaves it optional.
  • A writable open with WM_AT_REST_MODE=off onto a store whose keyring meta exists is refused (split-brain guard); read-only inspection still reports the mode.

Structs§

Argon2Params
Non-secret Argon2id parameters recorded in the keyring meta (mode C).
AtRestConfig
Environment-driven at-rest configuration.
AtRestState
Unlocked keyring state for a writable at-rest store.
AtRestStatusPresent
Parsed keyring status for a store with at-rest state.
KeyringMeta
Non-secret keyring meta row (JSON).
MigrationGalaxyState
Per-galaxy progress row in the slice-B background migration ledger.
MigrationLedger
The migration:v1 ledger row (keyring DBI).

Enums§

AtRestMode
At-rest mode for a store.
AtRestStatus
Read-only at-rest disclosure status (meta only — never resolves the RK).

Constants§

AT_REST_KEY_FILE
Default generated key-file name.
AT_REST_KEY_LEN
Root-key length (and generated key-file length) in bytes.
DEK_KEY_PREFIX
Prefix of the dek:<galaxy-db-name> rows holding wrapped galaxy DEKs.
KEYRING_DB
LMDB DBI holding the at-rest key material.
KEYRING_FORMAT_VERSION
Current keyring meta format version.
KEYRING_META_KEY
Keyring row holding the (non-secret) meta JSON.
MIGRATION_LEDGER_KEY
Keyring row holding the slice-B background-migration ledger (JSON).
RK_CHECK_INFO
AAD (and known plaintext) for the rk:check row.
RK_CHECK_KEY
Keyring row holding the wrong-key discriminator (AEAD wrap of a fixed known plaintext under RK; AAD wm/at-rest/rk-check/v1).
RK_CHECK_PLAINTEXT
Fixed known plaintext wrapped under RK into rk:check.

Functions§

generated_key_path
Resolve the generated key-file path for a store directory.