pub struct StackDocV1 {
pub stack_doc_schema: u16,
pub stack_id: Uuid,
pub album_id: Uuid,
pub labels: OrSet<String>,
pub unknown: BTreeMap<String, Value>,
pub signature: Option<HybridSignature>,
}Expand description
A stack’s signed label record.
Fields§
§stack_doc_schema: u16Schema version — integer field 0.
stack_id: UuidThe stack this record speaks for (UUIDv7).
album_id: UuidThe container album every member of the stack belongs to; its AMK seals this record.
labels: OrSet<String>The stack’s labels.
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 StackDocV1
impl StackDocV1
Sourcepub fn new(stack_id: Uuid, album_id: Uuid) -> Self
pub fn new(stack_id: Uuid, album_id: Uuid) -> Self
An empty, unsigned record for stack_id in album_id.
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 merge(&mut self, other: &Self) -> Result<(), DocError>
pub fn merge(&mut self, other: &Self) -> Result<(), DocError>
Merge another replica of the same stack’s record: labels by OR-set union, unknown keys by a deterministic fold. The signature is dropped when the merge changed anything.
§Errors
DocError::IdMismatch when other speaks for another stack, or places the stack in
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 (its album’s current epoch) with a fresh nonce.
§Errors
DocError::Crypto if sealing fails.
Sourcepub fn open_sealed(
wire: &[u8],
amk: &Amk,
stack_id: &Uuid,
max_known: u16,
) -> Result<Self, DocError>
pub fn open_sealed( wire: &[u8], amk: &Amk, stack_id: &Uuid, max_known: u16, ) -> Result<Self, DocError>
Open a record sealed by seal for stack_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 stack, and the decode errors of
from_canonical_slice.
Trait Implementations§
Source§impl Clone for StackDocV1
impl Clone for StackDocV1
Source§fn clone(&self) -> StackDocV1
fn clone(&self) -> StackDocV1
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 StackDocV1
impl Debug for StackDocV1
Source§impl PartialEq for StackDocV1
impl PartialEq for StackDocV1
Source§fn eq(&self, other: &StackDocV1) -> bool
fn eq(&self, other: &StackDocV1) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StackDocV1
Auto Trait Implementations§
impl Freeze for StackDocV1
impl RefUnwindSafe for StackDocV1
impl Send for StackDocV1
impl Sync for StackDocV1
impl Unpin for StackDocV1
impl UnsafeUnpin for StackDocV1
impl UnwindSafe for StackDocV1
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