Expand description
The durable album-key store: every album’s AMK ledger, write-tier + admin signing seeds, and attested authority state, sealed at rest under the account master key.
Album keys used to be session-scoped — minted per Workspace and dropped on close — so a
reopened library could neither decrypt nor write its own prior assets. This module is the
durable half of the key chain the
keystore (Account) already provides for device identity keys: AccountFile persists
the master key (passphrase-wrapped) and the device private keys (master-sealed);
AlbumStore persists everything below the master key that an album needs.
§On-disk format
One file, {root}/.library/albums.cbor:
MasterKey::seal( canonical_cbor(AlbumStore) ) # nonce(12) ‖ AES-256-GCM(ct+tag)- Sealed under
MasterKey::seal— the same AES-256-GCM random-nonce primitiveAccountFileuses for the sealed device seeds. This is deliberately notbackup::artifact::seal_ledger, whose nonce is derived deterministically from the wrap key so that re-exporting a backup is byte-identical. That property is right for a write-once artifact and catastrophic here: the store is rewritten on everycreate_albumandrotate_epoch, so a fixed nonce under a fixed key would repeat(key, nonce)across different plaintexts and leak the keystream. - Canonical CBOR, sorted by album id (and each album’s AMK rows by epoch), so the plaintext is byte-stable for a given logical state.
- Written temp-then-rename by
capsule-library’sAlbumStoreFile::save, so a crash mid-write never leaves a half-written keystore where the previous good one was. - The AMK rows reuse the backup artifact’s row shape
(album_id, epoch, amk), so keystore ↔ backup-ledger conversion is amap, not a translation table.
§Recovered (read-only) albums
A backup artifact escrows AMKs — read access — but never the write-tier or admin signing
keys, which are MLS-distributed capabilities. It does carry each album’s public
authority, the admin-signed epoch ledger (#468). An album restored from a backup into a
library that never held it therefore lands here with write_tier_seed64 = None,
admin_seed64 = None, and authority = Some(Reference(ledger)) (or None from a format-1
artifact, which carried no ledger): its photos decrypt, re-export, and verify, but it cannot
author new writes until its signing capability is re-established. That is the honest state,
and the lifecycle surfaces it as a typed error rather than minting a fresh admin key that
attests nothing and no peer trusts. The ledger re-verifies on every load, like any other.
Structs§
- Album
Store - Every album this library holds key material for, sealed at rest under the account master key.
- Persisted
Album - One album’s persisted key material.
Enums§
- Album
Store Error - Errors from reading, writing, or decoding the album store.
- Escrow
Coverage - How an album key escrow the server holds stands against the album a device holds
(
PersistedAlbum::escrow_coverage). OnlySupersededis a state the device may overwrite: every other one either needs nothing or would lose an epoch. - Persisted
Authority - One album’s persisted authority state, behind the
AlbumAuthorityseam.
Constants§
- ALBUM_
STORE_ FILE - The store’s filename beneath
{root}/.library/.
Type Aliases§
- AmkRow
- One escrowed album content key:
(album_id, epoch, amk).