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
impl Assertion
The author’s certificate chain.
Sourcepub fn signature(&self) -> &SerdeSig
pub fn signature(&self) -> &SerdeSig
The detached signature alone, for a record that cites the author’s certificate instead of carrying it.
Sourcepub fn from_parts(author: CertChain, sig: SerdeSig) -> Self
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.
Sourcepub fn verify(
&self,
cid: &ContentId,
trust_root: &[u8; 32],
generation: u64,
) -> Result<()>
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.
Sourcepub fn verify_user(
&self,
cid: &ContentId,
user: &UserPublic,
generation: u64,
) -> Result<()>
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.