Skip to main content

BackupArtifact

Struct BackupArtifact 

Source
pub struct BackupArtifact { /* private fields */ }
Expand description

A verified, opened backup artifact, ready to restore.

Implementations§

Source§

impl BackupArtifact

Source

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.

Source

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.

Source

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.

Source

pub fn authority_ledgers(&self) -> &BTreeMap<Uuid, SignedEpochLedger>

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.

Source

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.

Source

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.

Source

pub fn amk(&self, album_id: &Uuid, epoch: u32) -> Option<[u8; 32]>

The escrowed AMK for (album_id, epoch), if the ledger holds it.

Source

pub fn exporter_device(&self) -> Uuid

The exporter device id recorded in the manifest (provenance: who exported).

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more