pub struct AlbumDocV1 {
pub album_doc_schema: u16,
pub album_id: Uuid,
pub labels: OrSet<String>,
pub name: Lww<String>,
pub unknown: BTreeMap<String, Value>,
pub signature: Option<HybridSignature>,
}Expand description
An album’s signed label record.
Fields§
§album_doc_schema: u16Schema version — integer field 0.
album_id: UuidThe album this record speaks for (UUIDv7).
labels: OrSet<String>The album’s labels.
name: Lww<String>The album’s display name.
unknown: BTreeMap<String, Value>Unknown CBOR keys preserved verbatim (covered by the signature).
signature: Option<HybridSignature>Hybrid signature over every other field.
Implementations§
Source§impl AlbumDocV1
impl AlbumDocV1
Sourcepub fn signing_bytes(&self) -> Vec<u8> ⓘ
pub fn signing_bytes(&self) -> Vec<u8> ⓘ
The canonical bytes the signature covers (everything except signature).
Sourcepub fn to_canonical_vec(&self) -> Vec<u8> ⓘ
pub fn to_canonical_vec(&self) -> Vec<u8> ⓘ
The full canonical encoding, signature included.
Sourcepub fn sign(&mut self, ik: &HybridSigningKey)
pub fn sign(&mut self, ik: &HybridSigningKey)
Sign with the user identity key.
Sourcepub fn verify(&self, ik_public: &HybridVerifyingKey) -> bool
pub fn verify(&self, ik_public: &HybridVerifyingKey) -> bool
Verify against the user identity key. An unsigned record never verifies.
Sourcepub fn from_canonical_slice(
bytes: &[u8],
max_known: u16,
) -> Result<Self, DocError>
pub fn from_canonical_slice( bytes: &[u8], max_known: u16, ) -> Result<Self, DocError>
Decode from canonical CBOR, refusing a schema newer than max_known.
§Errors
Sourcepub fn current_name(&self) -> Option<&str>
pub fn current_name(&self) -> Option<&str>
The album’s current name, if one was ever written.
Sourcepub fn merge(&mut self, other: &Self) -> Result<(), DocError>
pub fn merge(&mut self, other: &Self) -> Result<(), DocError>
Merge another replica of the same album’s record: labels by OR-set union, the name by LWW, unknown keys by a deterministic fold. The signature is dropped when the merge changed anything, so the caller re-signs what it now holds.
§Errors
DocError::IdMismatch when other speaks for another album; nothing is merged.
Sourcepub fn seal(&self, amk: &Amk) -> Result<Vec<u8>, DocError>
pub fn seal(&self, amk: &Amk) -> Result<Vec<u8>, DocError>
Seal the full record under amk (the album’s current epoch) with a fresh nonce.
§Errors
DocError::Crypto if sealing fails.
Sourcepub fn open_sealed(
wire: &[u8],
amk: &Amk,
album_id: &Uuid,
max_known: u16,
) -> Result<Self, DocError>
pub fn open_sealed( wire: &[u8], amk: &Amk, album_id: &Uuid, max_known: u16, ) -> Result<Self, DocError>
Open a record sealed by seal for album_id. The signature is not
checked here; the caller verifies against the signer it trusts.
§Errors
DocError::Crypto when amk does not open it, DocError::IdMismatch when it speaks
for another album, and the decode errors of
from_canonical_slice.
Trait Implementations§
Source§impl Clone for AlbumDocV1
impl Clone for AlbumDocV1
Source§fn clone(&self) -> AlbumDocV1
fn clone(&self) -> AlbumDocV1
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 AlbumDocV1
impl Debug for AlbumDocV1
Source§impl PartialEq for AlbumDocV1
impl PartialEq for AlbumDocV1
Source§fn eq(&self, other: &AlbumDocV1) -> bool
fn eq(&self, other: &AlbumDocV1) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AlbumDocV1
Auto Trait Implementations§
impl Freeze for AlbumDocV1
impl RefUnwindSafe for AlbumDocV1
impl Send for AlbumDocV1
impl Sync for AlbumDocV1
impl Unpin for AlbumDocV1
impl UnsafeUnpin for AlbumDocV1
impl UnwindSafe for AlbumDocV1
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> 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