Trait openmls::ciphersuite::signable::Verifiable
source · pub trait Verifiable: Sized {
// Required methods
fn unsigned_payload(&self) -> Result<Vec<u8>, Error>;
fn signature(&self) -> &Signature;
fn label(&self) -> &str;
// Provided methods
fn verify<T>(
self,
crypto: &impl OpenMlsCrypto,
pk: &OpenMlsSignaturePublicKey
) -> Result<T, SignatureError>
where T: VerifiedStruct<Self> { ... }
fn verify_no_out(
&self,
crypto: &impl OpenMlsCrypto,
pk: &OpenMlsSignaturePublicKey
) -> Result<(), SignatureError> { ... }
}
Expand description
The verifiable trait must be implemented by any struct that is signed with
a credential. The actual verify
method is provided.
The unsigned_payload
and signature
functions have to be implemented for
each struct, returning the serialized payload and the signature respectively.
Note that Verifiable
should not be implemented on the same struct as
Signable
. If this appears to be necessary, it is probably a sign that the
struct implementing them aren’t well defined. Not that both traits define an
unsigned_payload
function.
Required Methods§
Provided Methods§
sourcefn verify<T>(
self,
crypto: &impl OpenMlsCrypto,
pk: &OpenMlsSignaturePublicKey
) -> Result<T, SignatureError>where
T: VerifiedStruct<Self>,
fn verify<T>( self, crypto: &impl OpenMlsCrypto, pk: &OpenMlsSignaturePublicKey ) -> Result<T, SignatureError>where T: VerifiedStruct<Self>,
Verifies the payload against the given credential
.
The signature is fetched via the Verifiable::signature()
function and
the payload via Verifiable::unsigned_payload()
.
Returns Ok(Self::VerifiedOutput)
if the signature is valid and
CredentialError::InvalidSignature
otherwise.
sourcefn verify_no_out(
&self,
crypto: &impl OpenMlsCrypto,
pk: &OpenMlsSignaturePublicKey
) -> Result<(), SignatureError>
fn verify_no_out( &self, crypto: &impl OpenMlsCrypto, pk: &OpenMlsSignaturePublicKey ) -> Result<(), SignatureError>
Verifies the payload against the given credential
.
The signature is fetched via the Verifiable::signature()
function and
the payload via Verifiable::unsigned_payload()
.
Returns Ok(())
if the signature is valid and
CredentialError::InvalidSignature
otherwise.