Skip to main content

PersistedAlbum

Struct PersistedAlbum 

Source
pub struct PersistedAlbum {
    pub album_id: Uuid,
    pub name: String,
    pub amks: Vec<AmkRow>,
    pub current_epoch: u32,
    pub write_tier_seed64: Option<ByteBuf>,
    pub admin_seed64: Option<ByteBuf>,
    pub authority: Option<PersistedAuthority>,
}
Expand description

One album’s persisted key material.

Fields§

§album_id: Uuid

Album id.

§name: String

Display name.

§amks: Vec<AmkRow>

The AMK ledger: one (album_id, epoch, amk) row per epoch, kept sorted by epoch.

§current_epoch: u32

The current (highest) epoch — the one new writes are authored under.

§write_tier_seed64: Option<ByteBuf>

The per-album write-tier signing key’s 64-byte hybrid seed (Ed25519 ‖ ML-DSA-65). None for an album recovered from a backup artifact, which escrows no write capability.

§admin_seed64: Option<ByteBuf>

The per-album admin signing key’s 64-byte hybrid seed. None as above.

§authority: Option<PersistedAuthority>

The attested authority state. For a backup-recovered album, the public ledger the artifact carried, or None when it carried none.

Implementations§

Source§

impl PersistedAlbum

Source

pub fn recovered( album_id: Uuid, name: &str, amks: Vec<AmkRow>, authority: Option<PersistedAuthority>, ) -> Self

A read-only album entry: escrowed AMKs and, when the artifact carried one, the album’s public authority — but no write or admin capability. This is what a backup restore can honestly reconstruct.

Source

pub fn held_epochs(&self) -> BTreeSet<u32>

The epochs whose AMK content key this device holds — the input that restores a reference authority’s local-only amk_present flags.

Source

pub fn write_tier_key( &self, ) -> Result<Option<HybridSigningKey>, AlbumStoreError>

Decode the write-tier signing key, if this album carries write capability.

Source

pub fn admin_key(&self) -> Result<Option<HybridSigningKey>, AlbumStoreError>

Decode the admin signing key, if this album carries admin capability.

Source

pub fn seal_escrow( &self, master: &MasterKey, ) -> Result<Vec<u8>, AlbumStoreError>

This album’s server-side key escrow: its canonical CBOR behind a versioned domain separator, sealed under the account master key with MasterKey::seal.

Everything the album holds travels — every epoch’s AMK, the write-tier and admin seeds, and the authority — so a device recovered from the master key alone holds the album as the device that escrowed it did. It adds no root: only the master key opens it, and the master key already opens the keystore file this is a slice of. The seal draws a fresh nonce, so two escrows of one state differ in their bytes; escrow_matches compares what they open to.

§Errors

AlbumStoreError::Cbor when the album does not encode.

Source

pub fn open_escrow( blob: &[u8], master: &MasterKey, album_id: Uuid, ) -> Result<Self, AlbumStoreError>

Open an album key escrow seal_escrow produced, served under album_id.

§Errors

AlbumStoreError::Crypto when the master key does not open it (another account’s, or tampered), AlbumStoreError::NotAnAlbumKeyEscrow when it opens but is another kind of sealed blob, AlbumStoreError::Cbor when it does not decode, and AlbumStoreError::EscrowAlbumMismatch when it holds an album other than album_id.

Source

pub fn escrow_matches(&self, blob: &[u8], master: &MasterKey) -> bool

Whether blob is an escrow of exactly this album’s current state: it opens under master as this album, and what it holds encodes to the same canonical bytes. Any failure to open is false.

Source

pub fn escrow_coverage(&self, blob: &[u8], master: &MasterKey) -> EscrowCoverage

How the escrow blob the server holds for this album stands against this album’s state — and so whether replacing it with this album’s escrow can only add to it.

The comparison is per epoch: an escrow is never replaced by one that lacks an epoch it holds, or that holds a different key for an epoch they share, because a recovery from the replacement would lose that epoch’s assets. Nor is it replaced by one that lacks a write-tier seed, admin seed or authority it holds: a read-only device (one restored from a backup) would otherwise strip the capability every later recovery depends on. See EscrowCoverage.

Trait Implementations§

Source§

impl Clone for PersistedAlbum

Source§

fn clone(&self) -> PersistedAlbum

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PersistedAlbum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PersistedAlbum

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PersistedAlbum

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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