vc only.Expand description
Validation of credential and presentation JWTs: signature, binding to the issuer or holder, validity period, audience, nonce and status.
The validators take two extension points: a KeyResolver, which turns the kid of a JWT
into the public key of its signer and is implemented by the crate’s
Resolver, and a JwsVerifier, which checks the signature
and is DefaultVerifier unless an application substitutes
its own. A StatusCheck is a third, optional one for credentialStatus.
§What is checked
For a credential (JwtCredentialValidator):
- The token is a compact JWS whose header has a
kidthat is a DID URL of the formdid:…#fragment: a path or DID parameters such asversionIdare refused, so the signer cannot pick the document version its key is looked up in (ADR 0004). Whentypis present it names the profile:JWTfor VCDM 1.1,vc+jwtfor VCDM 2.0. - The payload is a claims set that maps to a
Credential(or aCredentialV2), with its registered claims agreeing with the credential. - The key
kidnames is resolved under theassertionMethodrelationship and verifies the signature. - The issuer is the DID of
kid: the key that signed is the issuer’s. nbf,expandiat, and the credential’s own validity period, hold at the validation time, within the leeway.credentialStatuspasses theStatusCheck, per theStatusPolicy.
For a presentation (JwtPresentationValidator): the same for the presentation JWT, with
the key resolved under authentication and the holder as the signer, plus the expected
audience and nonce; then every credential it carries is validated as above, and its subject
is checked against the holder per the SubjectHolderRelationship.
Everything a verifier decides by policy (which issuers to trust, which credential types to
accept, what the claims must say) is left to the application, which gets the decoded
credential back. decode_credential, decode_credential_v2 and
decode_presentation decode without verifying, for a look at a token before deciding how
to validate it; extract_issuer and extract_holder read just the signer’s DID.
Structs§
- Credential
Validation Options - Options of
JwtCredentialValidator. - Decoded
Credential - A validated or decoded VCDM 1.1 credential JWT: its header, its claims (custom ones included) and the credential they map to.
- Decoded
Credential V2 - A validated or decoded VCDM 2.0 credential JWT: its header, its claims and the credential.
- Decoded
Presentation - A validated or decoded VCDM 1.1 presentation JWT: its header, its claims (custom ones included), the presentation, and its credentials decoded.
- JwtCredential
Validator - Validates credential JWTs, see the module documentation for the checks.
- JwtPresentation
Validator - Validates presentation JWTs and the credential JWTs they carry, see the module documentation for the checks.
- KeyResolution
Error - Why a key could not be resolved for a
KeyResolver. - Presentation
Validation Error - Why a presentation did not validate: the presentation itself, or some of its credentials.
- Presentation
Validation Options - Options of
JwtPresentationValidator. - Time
Options - The validation time and the clock skew allowed around it.
Enums§
- Fail
Fast - Whether to stop at the first failing credential of a presentation.
- Status
Error - Why a
StatusCheckdid not pass. - Status
Policy - What to do about a
credentialStatusentry. - Subject
Holder Relationship - How the subject of a presented credential must relate to the holder presenting it.
- Validation
Error - Why a credential or presentation JWT did not validate.
Traits§
- KeyResolver
- Finds the public key a JWT was signed with, given the DID URL in its
kid. - Status
Check - Checks the
credentialStatusof a credential: fetches the status list, bitmap or registry the entry points to and reports whether the credential is still good.
Functions§
- decode_
credential - Decodes a VCDM 1.1 credential JWT without verifying or validating anything.
- decode_
credential_ v2 - Decodes a VCDM 2.0 credential JWT without verifying or validating anything.
- decode_
presentation - Decodes a VCDM 1.1 presentation JWT and its credentials without verifying or validating anything.
- extract_
holder - The DID of the holder of a presentation JWT, read without verifying anything:
iss, else theholderof thevpclaim (VCDM 1.1) or of the payload (VCDM 2.0). - extract_
issuer - The DID of the issuer of a credential JWT, read without verifying anything:
iss, else theissuerof thevcclaim (VCDM 1.1) or of the payload (VCDM 2.0).