pub trait HashableCredential {
// Required methods
fn claims_hash(&self) -> Result<FieldElement, Error>;
fn hash(&self) -> Result<FieldElement, Error>;
fn verify_signature(
&self,
expected_issuer_pubkey: &EdDSAPublicKey,
) -> Result<bool, Error>;
}Expand description
Introduces hashing and signing capabilities to the Credential type.
Required Methods§
Sourcefn claims_hash(&self) -> Result<FieldElement, Error>
fn claims_hash(&self) -> Result<FieldElement, Error>
Get the claims hash of the credential.
§Errors
Will error if there are more claims than the maximum allowed. Will error if the claims cannot be lowered into the field. Should not occur in practice.
Sourcefn hash(&self) -> Result<FieldElement, Error>
fn hash(&self) -> Result<FieldElement, Error>
The hash is signed by the issuer to provide authenticity for the credential.
§Errors
- Will error if there are more claims than the maximum allowed.
- Will error if the claims cannot be lowered into the field. Should not occur in practice.
Sourcefn verify_signature(
&self,
expected_issuer_pubkey: &EdDSAPublicKey,
) -> Result<bool, Error>
fn verify_signature( &self, expected_issuer_pubkey: &EdDSAPublicKey, ) -> Result<bool, Error>
Verify the signature of the credential against the issuer public key and expected hash.
§Errors
Will error if the credential is not signed. Will error if the credential cannot be hashed.