Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

The offline asset lifecycle — the integration layer that ties the cryptographic data plane to the on-disk client library, and the substrate the CLI showcase drives.

A Workspace holds an unlocked [Account], the per-album key material + its ReferenceAuthority, and the signed device directory. Each operation produces the design’s real artifacts and self-checks them through verify_asset:

  • import_asset — derive the file key, STREAM-encrypt to get the content hash, build + sign the create manifest, append the provenance chain, write the signed [SidecarV1], and gate on verify_asset == Accept.
  • tag_add / set_caption — CRDT edits emitting a metadata-update provenance record.
  • soft_delete / restore / purge — delete (with a signed retention window) and trash-restore lifecycle records, and the hard delete, each judged by the signed retention_until.
  • export_backup / import_backup — the portable artifact round-trip; the client stores plaintext, so ciphertext is regenerated deterministically from the manifest’s recorded nonce prefix.
  • adopt_remote_head / adopt_remote_original / adopt_remote_history — hold an asset another device wrote, from a verified sync entry (and, for an asset first seen past its create, its fetched earlier records): its chain, sidecar, sealed metadata blob and original under media/, indexed, so the verbs above work on it as on an import.

Clients store plaintext locally (original + signed sidecar + provenance chain); encryption produces the artifacts that cross a boundary. Offline epoch rotation is supported (rotate_epoch); the MLS membership ceremony (Welcome, add/remove) remains deferred (see SLICES.md).

Re-exports§

pub use crate::account::HardwareSignerBinding;

Structs§

AdoptedAlbumKeys
What Workspace::adopt_album_key_escrows did.
AlbumKeyEscrowPlan
What Workspace::plan_album_key_escrows decided, per album, in album id order.
AlbumKeys
One album’s key material across one or more epochs.
AssetState
In-memory state for one managed asset.
DerivativeBlob
One derivative blob of an asset bundle: the ciphertext plus the content address its signed [DerivativeManifest] committed to.
EnrolleeKeys
What the enrollee (the new device B) advertises: the public halves of the device keys it generated, which A cross-signs into the directory.
FeedDrain
A sync that drained the feed to its head: the evidence a retention sweep needs before it judges a deadline (Peering — Sync).
HardwareDekBinding
A request to bind this workspace’s device encryption key to a per-platform secure element: the P-256 key-agreement element itself plus the alias its key is held under.
InitiatorKeys
What the initiator (the enrolled device A) advertises: the account it is adding to, the identity key the directory it will send verifies under, and its own device signing key.
OriginalChanged
The plaintext on disk is no longer the file an OriginalCiphertext was verified from.
OriginalCiphertext
The original’s ciphertext as a source, not a buffer: the plaintext’s path on disk, the per-file key and the nonce prefix the signed manifest recorded.
PeerExport
The assets a peer’s delta artifact is cut from (Workspace::peer_export).
PurgeOutcome
What a purge did.
RemoteAssetFacts
The verified facts one remote entry contributes to the receiving catalog.
RemoteEntry
One remote feed entry, exactly as a sync feed delivers it: opaque bytes plus the album the entry claims and the head the receiving catalog already holds. Borrowed rather than owned so a caller hands over buffers it already has without a copy.
RemoteHead
A RemoteEntry whose original ciphertext is named by its SHA-256 rather than carried: what a caller holds when the original is too large to keep in memory — a restore that streams it to disk, say.
ResealOutcome
What one re-seal did.
SidecarEnrichment
Out-of-band metadata a third-party source adapter folded for one media file, in the shape the signed sidecar stores it.
SignedImport
What one signed import produced: the asset’s id plus whether derivatives could be generated for it.
SignedImportOptions
Options for a signed import driven by the import executor. Defaults (Copy mode, no stack, no exporter metadata) reproduce the standalone Workspace::import_asset behaviour.
StackPlacement
The index projection of an asset’s stack membership: the two assets columns (stack_id, is_stack_hidden) that keep a non-primary member out of the timeline.
StreamedImport
A streamed import: everything the streaming window needs about one just-imported asset to drive its upload → verify → release step, without exposing workspace internals. Produced by Workspace::import_asset_streaming, which commits on the signed path with source release deferred to the server-side verify-before-destroy gate, since in streaming mode the local bytes are the only copy until the server durably holds them.
TrashEntry
One asset in the trash, as its latest signed delete record describes it.
UnanchoredSidecar
One sidecar file under media/ that no provenance chain anchors — an asset the workspace cannot see.
UploadBundle
Everything needed to push one managed asset: its identity, the re-derived original ciphertext, the exact sealed metadata blob, any derivative blobs, and the manifest-envelope projection fields the server validates. Carries no Workspace internals and no album key material — the AMK never leaves the workspace. The one secret it holds is the original’s per-file key, privately inside OriginalCiphertext, which can open that one file and nothing else.
Workspace
An offline Capsule workspace over a client library directory.

Enums§

Adoption
What adopting one applied entry did to the assets this workspace holds (Workspace::adopt_remote_head, Workspace::adopt_remote_original).
DerivativeStatus
Whether an imported asset got thumbnail/preview derivatives — and if not, why
EnrollmentPayload
One message relayed between the two devices.
EnrollmentPayloadError
Why a relayed payload could not be encoded or decoded.
LifecycleError
Errors from lifecycle operations.
QuarantineReason
Why an entry was quarantined: surfaced to the user, never silently dropped.
RemoteOriginal
How Workspace::open_remote_original (P = Vec<u8>) or Workspace::open_remote_original_from (P = the caller’s writer) resolved.
ResealRefusal
Why Workspace::reseal_create refused an asset. Each is a state in which writing a new genesis record would be wrong or impossible; none of them writes anything.
SyncApplyOutcome
How applying one remote entry resolved. These three are the verdicts the client validation duties permit — there is no fourth, “ignored” case.
UnanchoredShape
The shape of a {uuid}.cbor under media/ that no .provenance.cbor anchors.

Constants§

ENROLLMENT_NONCE_LEN
The length of each side’s per-ceremony nonce. Device keys are static — the initiator’s are already published — so without fresh randomness on both sides a man in the middle could predict one side’s input and grind the code offline.
ENROLLMENT_PAYLOAD_VERSION
The payload format version this build writes and the only one it reads.
MAX_ENROLLMENT_PAYLOAD_CHARS
The longest encoded payload this build writes or reads, in characters — the relay’s own per-payload ceiling, so a payload this side accepts is one the relay would have carried.
OPAQUE_CONTENT_TYPE
The content_type of a blob the server is not told the kind of.
WIRE_ORIGINAL_CONTENT_TYPES
The original media types the upload protocol’s closed content_type enum names for this protocol version (server-side validation, invariant 5). Every other blob — and every original whose type is not here — declares OPAQUE_CONTENT_TYPE, which the enum also names.

Functions§

enrollment_safety_code
The safety code both devices display, over the initiator’s and the enrollee’s advertised keys as each side received them.
hash_ciphertext_from
The SHA-256 and length of the original ciphertext ciphertext yields, read one STREAM chunk at a time: the RemoteHead::original_ciphertext_hash for an original that is on disk rather than in memory, computed in memory bounded by one chunk whatever the original’s size.
unanchored_sidecars
The sidecars under the library at root that no provenance chain anchors — the set Workspace::open reports through Workspace::unanchored_sidecars, found without a passphrase or any key material.
wire_content_type
The content_type an original of media type content_type declares on the wire: itself when the protocol’s closed enum names it, OPAQUE_CONTENT_TYPE otherwise.