#[non_exhaustive]
pub struct CredentialValidator;
Expand description

A struct for validating Credentials.

Implementations

Validates a Credential.

The following properties are validated according to options:

  • the issuer’s signature,
  • the expiration date,
  • the issuance date,
  • the semantic structure.
Warning

The lack of an error returned from this method is in of itself not enough to conclude that the credential can be trusted. This section contains more information on additional checks that should be carried out before and after calling this method.

The state of the issuer’s DID Document

The caller must ensure that issuer represents an up-to-date DID Document. The convenience method Resolver::resolve_credential_issuer can help extract the latest available state of the issuer’s DID Document.

Properties that are not validated

There are many properties defined in The Verifiable Credentials Data Model that are not validated, such as: credentialStatus, type, credentialSchema, refreshService, and more. These should be manually checked after validation, according to your requirements.

Errors

An error is returned whenever a validated condition is not satisfied.

Validates the semantic structure of the Credential.

Warning

This does not validate against the credential’s schema nor the structure of the subject claims.

Validate that the Credential expires on or after the specified Timestamp.

Validate that the Credential is issued on or before the specified Timestamp.

Verify the signature using the DID Document of a trusted issuer.

Warning

The caller must ensure that the DID Documents of the trusted issuers are up-to-date.

Errors

This method immediately returns an error if the credential issuer’ url cannot be parsed to a DID belonging to one of the trusted issuers. Otherwise an attempt to verify the credential’s signature will be made and an error is returned upon failure.

Validate that the relationship between the holder and the credential subjects is in accordance with relationship.

Checks whether the credential status has been revoked.

Only supports BitmapRevocation2022.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more