Skip to main content

Assertion

Struct Assertion 

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

An author’s detached signature over a ContentId, with the certificate chain that lets any reader check who the author is.

Implementations§

Source§

impl Assertion

Source

pub fn sign(author: &AgentKey, cid: &ContentId) -> Self

author vouches for cid.

Source

pub fn author(&self) -> &CertChain

The author’s certificate chain.

Source

pub fn signature(&self) -> &SerdeSig

The detached signature alone, for a record that cites the author’s certificate instead of carrying it.

Source

pub fn from_parts(author: CertChain, sig: SerdeSig) -> Self

An assertion from a certificate chain and a signature kept apart. The pair is not checked here: Assertion::verify is what says whether sig is author’s.

Source

pub fn verify( &self, cid: &ContentId, trust_root: &[u8; 32], generation: u64, ) -> Result<()>

Check that the author signed cid and that the author’s chain passes is rooted at trust_root (the flock server’s agent public key) at epoch generation: the trust root must be the root agent, the certificate issued by the user. An intermediate or leaf key matching is refused. Two servers of one user share a user key but not an agent key.

§Errors

MeshError::BadSignature if the signature does not match cid; MeshError::InvalidCertChain / generation / amplification errors if the chain is bad or its root agent is not trust_root.

Source

pub fn verify_user( &self, cid: &ContentId, user: &UserPublic, generation: u64, ) -> Result<()>

Check that the author signed cid with a key the user user certified directly (a device key: the chain is one link, issued by that user) at epoch generation. Which devices count is the caller’s to decide.

§Errors

MeshError::InvalidCertChain if the chain is not issued directly by user or fails verification; MeshError::BadSignature if the signature does not match cid.

Trait Implementations§

Source§

impl Clone for Assertion

Source§

fn clone(&self) -> Self

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 Assertion

Source§

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

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

impl<'de> Deserialize<'de> for Assertion

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 Eq for Assertion

Source§

impl PartialEq for Assertion

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Assertion

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

impl StructuralPartialEq for Assertion

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

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

Source§

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.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V