Skip to main content

VC Validator

Interactive example​

Validate a Verifiable Credential (VC) or a Verifiable Presentation (VP) using our libraries.

Loading the Trusted Nodes List…

Paste a JWT.


Library​

The validator uses two open-source packages:

Entry points​

Each package has three entry points:

Entry pointContent
.Shared types, EbsiEnvConfiguration and the error classes
./vcdm11.jsverifyCredentialJwt / verifyPresentationJwt for VCDM 1.1
./vcdm20.jsverifyCredentialJwt / verifyPresentationJwt for VCDM 2.0

Functions​

verifyCredentialJwt(jwt: string, config: EbsiEnvConfiguration, options?: VerifyCredentialOptions)
verifyPresentationJwt(jwt: string, audience: string, config: EbsiEnvConfiguration, options?: VerifyPresentationJwtOptions)

config describes the EBSI environment: hosts, network ({ name: "test" }), scheme ("ebsi"), services (the list of EBSI services to trust) and version ("v1"). The Source code tab of the validator shows a complete example.

Options​

Both functions share these options:

OptionDescription
validAtUnix timestamp used instead of the current time to check validity
clockSkewSeconds of tolerance applied around nbf and exp (default 0)
timeoutTimeout of the HTTP requests sent to EBSI services
axiosHeadersCustom headers added to those requests
proofPurposeVerification relationship the signing key must hold (default assertionMethod for credentials, authentication for presentations)
didRegistryContractAddressTarget a specific DID Registry instance. DIDs must prove they belong to it
issuersRegistryContractAddressTarget a specific Issuers Registry instance

verifyCredentialJwt also accepts trustChainRootDid (one DID: a RootTAO attribute that grants VerifiableAuthorisationForTrustChain must be issued by it), skipAccreditationsValidation, skipAccreditationWithoutTermsOfUseValidation, skipCredentialSubjectValidation, skipStatusValidation, extraCredentialSchemaTypes and skipTrustedIssuerValidationForSelfIssuedCredentials (both VCDM versions). The issuer of a Root TAO authorisation must also be the tao recorded on chain for its attribute, so trustChainRootDid can only name a Root TAO's own DID, never the Support Office. When it is not set, no root DID is pinned.

The VCDM 2.0 version also accepts trustFrameworkPolicyValidator, a hook that decides whether the Trust Framework Policy of the chain root is acceptable for your use case. It receives { rootDid, trustFramework, policyId, legalBasis, permissionFor, trustChain }, where permissionFor[].jurisdiction is a string[] and trustChain holds the permissions of every accreditation of the chain, from the issuer's up to the Root TAO's. It is called after the whole chain has been validated, so a chain error is reported first. Throw to reject the policy. The library doesn't compare jurisdictions itself.

verifyPresentationJwt also accepts maxIatAge (maximum age of the iat claim), skipHolderDidResolutionValidation, skipHolderDidRegistryProvenanceCheck and verifyCredentialOptions (options applied to each embedded credential). The audience is a positional argument: it must match the aud claim of the presentation.

Credential status​

Only BitstringStatusListEntry and EbsiAccreditationEntry are supported as credentialStatus types. StatusList2021Entry is not.

Errors​

ErrorMeaning
ValidationErrorBase class of validation failures
JsonSchemaValidationErrorThe input does not match its JSON Schema. ajvErrors lists the violations
JsonSchemaLoadingErrorA schema could not be loaded
ConfigurationErrorThe environment configuration is invalid
EbsiServiceMismatchErrorA URL does not point to the expected EBSI service
note

Schema, accreditation and status list URLs found in a credential (such as credentialSchema.id) must be trusted EBSI URLs: they must use the configured host and the expected service, and any query string or fragment is ignored.