Trait CredentialHolder

Source
pub trait CredentialHolder {
    // Required methods
    fn sig_type(&self) -> &'static str;
    fn reserve_size(&self) -> usize;
    fn sign(
        &self,
        signer_payload: &SignerPayload,
    ) -> Result<Vec<u8>, IdentityBuilderError>;
}
Expand description

An implementation of CredentialHolder is able to generate a signature over the SignerPayload data structure on behalf of a credential holder.

If network calls are to be made, it is better to implement AsyncCredentialHolder.

Implementations of this trait will specialize based on the kind of credential as specified in §8. Credentials, signatures, and validation methods from the CAWG Identity Assertion specification.

Required Methods§

Source

fn sig_type(&self) -> &'static str

Returns the designated sig_type value for this kind of credential.

Source

fn reserve_size(&self) -> usize

Returns the maximum expected size in bytes of the signature field for the identity assertion which will be subsequently returned by the sign function. Signing will fail if the subsequent signature is larger than this number of bytes.

Source

fn sign( &self, signer_payload: &SignerPayload, ) -> Result<Vec<u8>, IdentityBuilderError>

Signs the SignerPayload data structure on behalf of the credential holder.

If successful, returns the exact binary content to be placed in the signature field for this identity assertion.

The signature MUST NOT be larger than the size previously stated by the reserve_size function.

Implementors§