pub struct BackupArtifact { /* private fields */ }Expand description
A verified, opened backup artifact, ready to restore.
Implementations§
Source§impl BackupArtifact
impl BackupArtifact
Sourcepub fn open(
bytes: &[u8],
passphrase: &[u8],
exporter_pub: &HybridVerifyingKey,
) -> Result<Self, BackupError>
pub fn open( bytes: &[u8], passphrase: &[u8], exporter_pub: &HybridVerifyingKey, ) -> Result<Self, BackupError>
Open and fully verify an artifact: HMAC (wrap key) + exporter signature + per-entry content hashes + AMK-ledger completeness. The exporter key is looked up by the caller in the user’s device directory.
Sourcepub fn restore(
&self,
mode: RestoreMode,
local_heads: &BTreeMap<Uuid, Hash32>,
) -> Result<RestoreReport, BackupError>
pub fn restore( &self, mode: RestoreMode, local_heads: &BTreeMap<Uuid, Hash32>, ) -> Result<RestoreReport, BackupError>
Restore against a target library’s current provenance heads (asset_id -> head hash).
Preview checks structure only; DryRun (default) also decrypts to verify; Commit
returns the decrypted assets to write. Never overwrites newer local state.
Sourcepub fn amk_rows(&self) -> Vec<(Uuid, u32, [u8; 32])>
pub fn amk_rows(&self) -> Vec<(Uuid, u32, [u8; 32])>
The escrowed AMK rows this artifact carries: (album_id, epoch, amk).
The same row shape the durable album keystore holds
(AmkRow), so folding a restore’s recovered keys into a
library’s keystore is a map, not a translation table. This is the path by which a
library that lost its album keys becomes able to read its photos again — the backup path
is deliberately independent of the MLS ratchet (SSoT: Keys).
Note what is not here: the write-tier and admin signing keys. Those are MLS-distributed
capabilities, not escrowed secrets, so an album restored into a library that never held
it is readable but not writable. Its public authority rides separately
(authority_ledgers), which is what makes it verifiable.
Each album’s public authority the artifact carries: the admin-signed epoch ledger, keyed
by album id. Every ledger here was listed in the authenticated manifest, speaks for the
album it is filed under, and re-verified its admin signature chain in open.
Empty for a format-1 artifact, which carried none.
Sourcepub fn docs(&self) -> &[BackupDoc]
pub fn docs(&self) -> &[BackupDoc]
The sealed album and stack label records the artifact carries, each listed in the
authenticated manifest and sealed under an AMK amk returns. Empty for an
artifact exported before the records existed.
Sourcepub fn attestation_key_pins(&self) -> Option<&[u8]>
pub fn attestation_key_pins(&self) -> Option<&[u8]>
The library’s pinned attestation-key history the artifact carries
(.library/attestation-keys.cbor bytes, verbatim), listed in the authenticated manifest.
None for an artifact exported by a library that had pinned nothing, or before the pin
rode the artifact; such an artifact restores exactly as it did before.
Sourcepub fn amk(&self, album_id: &Uuid, epoch: u32) -> Option<[u8; 32]>
pub fn amk(&self, album_id: &Uuid, epoch: u32) -> Option<[u8; 32]>
The escrowed AMK for (album_id, epoch), if the ledger holds it.
Sourcepub fn exporter_device(&self) -> Uuid
pub fn exporter_device(&self) -> Uuid
The exporter device id recorded in the manifest (provenance: who exported).
Sourcepub fn provenance_heads(&self) -> &[(Uuid, Hash32)]
pub fn provenance_heads(&self) -> &[(Uuid, Hash32)]
The (asset_id, head_hash) provenance heads the artifact carries — the same list
restore reconciles against local state. Exposed so a chain-aware
consumer (LAN peering) can decide forward-update vs. stale per asset
before restoring, rather than treating every differing head as an opaque conflict.
Sourcepub fn provenance_chain(
&self,
asset_id: &Uuid,
) -> Result<Option<Vec<ProvenanceRecord>>, BackupError>
pub fn provenance_chain( &self, asset_id: &Uuid, ) -> Result<Option<Vec<ProvenanceRecord>>, BackupError>
The full provenance chain (oldest first) the artifact carries for asset_id, decoded
from its provenance/{asset_id} entry. None when the artifact carries no such asset.
Peering walks this chain to distinguish a forward artifact (whose chain contains the
receiver’s current head as an ancestor — safe to adopt) from a stale one (whose head
the receiver has already superseded — quarantined, never applied). The per-entry content
hashes were already verified by open, so the bytes here are authentic.
Auto Trait Implementations§
impl Freeze for BackupArtifact
impl RefUnwindSafe for BackupArtifact
impl Send for BackupArtifact
impl Sync for BackupArtifact
impl Unpin for BackupArtifact
impl UnsafeUnpin for BackupArtifact
impl UnwindSafe for BackupArtifact
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more