Expand description
The portable backup artifact and recovery mechanisms (SSoT: Backup and Recovery).
Two distinct things are kept separate:
- the backup artifact — a deterministic, self-describing, signed tar of a library’s encrypted blobs, metadata blobs, provenance chains, the AMK ledger needed to decrypt them, and each album’s public authority ledger needed to verify them;
- the master-key escrow — a small passphrase-wrapped blob that reconstructs the key hierarchy.
Recovery rests on one rule: holding the recovery secret restores every asset, even after every device is lost. The artifact carries its own AMK ledger, so it is self-sufficient.
Structs§
- Backup
Artifact - A verified, opened backup artifact, ready to restore.
- Backup
Asset - One asset to back up: its ciphertext, metadata blob, and full provenance chain.
- Backup
Doc - One sealed organization record riding the artifact:
docs/{kind}/{doc_id}. - Backup
Input - Everything needed to assemble an artifact.
- Restore
Report - The outcome of a restore (chain-reconciliation; newer local state always wins).
- Restored
Asset - A decrypted asset ready to write into a library (returned only on
Commit).
Enums§
- Backup
DocKind - Which organization record a
BackupDoccarries. - Backup
Error - Errors from backup export/restore and recovery.
- Restore
Mode - How aggressively a restore acts. Dry-run is the safe default.
- Verify
Outcome - Outcome of a local recovery-secret verification.
Constants§
- ARTIFACT_
FORMAT_ VERSION - The backup artifact format version.
- RECOVERY_
VERIFY_ V1 - Domain-separation label for the recovery-verification derived-tag compare (SSoT: Backup — Recovery Verification Cadence).
- SHAMIR_
SHARE_ LEN - Encoded length of one share of the 32-byte seed: the evaluation point
x, then 32ybytes. - WRAP_
PARAMS - The production Argon2id cost for the backup wrap key: the normal device tier.
Traits§
- Ciphertext
Source - Where an asset’s STREAM ciphertext comes from when it is written into an artifact.
Functions§
- escrow_
master_ key - Escrow the account master key under a recovery passphrase (Argon2id + AES-256-GCM).
- export
- Assemble a backup artifact in memory, drawing a fresh random wrap salt, at the production
WRAP_PARAMScost. - export_
to - Write a backup artifact into
out, drawing a fresh random wrap salt, at the productionWRAP_PARAMScost (production path), and return its length in bytes. - export_
with_ salt - Assemble a backup artifact with an explicit wrap salt (deterministic), at the production
WRAP_PARAMScost. - new_
recovery_ seed - Draw a fresh random 32-byte recovery seed.
- recover_
master_ key - Recover the master key from its escrow blob and the recovery passphrase.
- recover_
seed - Reconstruct a seed from a set of Shamir shares (≥ 2 of the 3).
- split_
seed_ 2of3 - Split a 32-byte recovery seed into 3 Shamir shares; any 2 reconstruct it, 1 reveals nothing. The default scheme from Backup — Opt-in: Shamir Secret Sharing.
- verify_
recovery_ secret - Local-only verification that the user still holds the recovery secret: unwrap the cached escrow blob, then compare an HKDF-derived tag against the tag derived from the device-held master key (derived-tag compare — raw key bytes are never compared or surfaced). Zero network I/O by construction; the cadence, snooze, and refresh-before-fail policy live in the client.