pub struct AlbumStore {
pub version: u16,
/* private fields */
}Expand description
Every album this library holds key material for, sealed at rest under the account master key.
Fields§
§version: u16On-disk format version.
Implementations§
Source§impl AlbumStore
impl AlbumStore
Sourcepub fn albums(&self) -> &[PersistedAlbum]
pub fn albums(&self) -> &[PersistedAlbum]
The persisted albums, sorted by id.
Sourcepub fn get(&self, album_id: &Uuid) -> Option<&PersistedAlbum>
pub fn get(&self, album_id: &Uuid) -> Option<&PersistedAlbum>
One album’s persisted material.
Sourcepub fn upsert(&mut self, album: PersistedAlbum)
pub fn upsert(&mut self, album: PersistedAlbum)
Insert or replace one album’s entry wholesale (the create_album / rotate_epoch path,
where the workspace holds the complete, authoritative material).
Sourcepub fn merge_amks(
&mut self,
album_id: Uuid,
name: &str,
rows: impl IntoIterator<Item = AmkRow>,
authority: Option<PersistedAuthority>,
) -> usize
pub fn merge_amks( &mut self, album_id: Uuid, name: &str, rows: impl IntoIterator<Item = AmkRow>, authority: Option<PersistedAuthority>, ) -> usize
Merge escrowed (album_id, epoch, amk) rows into the store — the backup-restore path.
An album already present keeps its write capability, admin key, and authority and simply gains any epochs it was missing; an unknown album is added as a read-only recovered entry. An epoch already held is never overwritten: the local copy is the one the local authority attests, and silently swapping a content key underneath it would be a downgrade vector. Returns the number of epochs actually added.
authority is the album’s public authority the artifact carried. It is adopted only by an
album that holds none — an unknown album, or one recovered earlier from an artifact that
carried no ledger. A held authority is never replaced, for the same downgrade reason.
Sourcepub fn open_sealed(
sealed: &[u8],
master: &MasterKey,
) -> Result<Self, AlbumStoreError>
pub fn open_sealed( sealed: &[u8], master: &MasterKey, ) -> Result<Self, AlbumStoreError>
Unseal a store from the bytes its file holds.
Refuses bytes the master key did not seal and a store declaring a newer format version.
Reading those bytes from {root}/.library/albums.cbor is capsule-library’s business.
Trait Implementations§
Source§impl Clone for AlbumStore
impl Clone for AlbumStore
Source§fn clone(&self) -> AlbumStore
fn clone(&self) -> AlbumStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AlbumStore
impl Debug for AlbumStore
Source§impl Default for AlbumStore
impl Default for AlbumStore
Source§impl<'de> Deserialize<'de> for AlbumStore
impl<'de> Deserialize<'de> for AlbumStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AlbumStore
impl RefUnwindSafe for AlbumStore
impl Send for AlbumStore
impl Sync for AlbumStore
impl Unpin for AlbumStore
impl UnsafeUnpin for AlbumStore
impl UnwindSafe for AlbumStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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