Skip to main content

VC Validator

Interactive example​

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

Paste a JWT or .


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)
didRegistryContractAddressTarget a specific DID Registry instance. DIDs must prove they belong to it
issuersRegistryContractAddressTarget a specific Issuers Registry instance

verifyCredentialJwt also accepts skipAccreditationsValidation, skipAccreditationWithoutTermsOfUseValidation, skipCredentialSubjectValidation, skipStatusValidation and extraCredentialSchemaTypes. The VCDM 1.1 version adds skipTrustedIssuerValidationForSelfIssuedCredentials.

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.

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.