#How to Verify a W3C Verifiable Credential (JWT / SD-JWT) via OID4VP with walt.id
TL;DR
This guide walks through verifying W3C JWT and SD-JWT credentials via OID4VP using the walt.id verifier API, covering request setup, policy enforcement, and result inspection. It shows how to manage redirects, callbacks, presentation definitions, and debugging data returned by the verifier endpoints.
What you’ll learn
Configure an OID4VP compliant authorization request using the /verify endpoint.
Apply VP/VC verification policies on received credentials.
Use custom input descriptors and relational constraints to enforce issuer, holder, or subject relationships.
Retrieve verification status, policy results, and inspect presented credentials via the verifier API.
This guide provides a comprehensive walkthrough for verifying a Verifiable Credential based on the W3C standard using
the walt.id verifier API. The verification process will utilize the OID4VCI protocol, an extension of OpenID,
facilitating secure and standardized communication between identities.
Verifiable Credential (VC): A digital equivalent of physical credentials such as a driver's license or university
degree. VCs are cryptographically secure, privacy-respecting, and instantly verifiable.
OID4VCI: A protocol specifying how parties can issue VCs and present these credentials in a way that's consistent
and secure across platforms ensuring interoperability.
First, determine the type of Verifiable Credential to be verified. Although this guide focuses on a "VerifiableDiploma,"
you can use any credential type compliant with the W3C standard.
The verification process will be as follows:
Specify the credential type(s) to request from a user and the verification policies to be applied to the credential(
s).
Optionally provide a success and failure redirect URL, which the user will be redirected to after the verification
process is completed.
API returns a URL which can passed to OIDC-compliant wallet to fulfill the request.
If you have provided a success or failure redirect URL, the user will be redirected to that URL. You can then access the
verification results by using the id of the verification session, which can be found in the URL generated by the API, as
well as in the query or path parameters of the redirect URL.
For this example, we will only do a simple verification, where we request one credential type, a Verifiable Diploma, and
let the system apply the default signature policy to verify the validity of the signature of the presented credential.
Optionally we can provide a success and failure redirect URL, which the user will be redirected to after the
verification.
authorizeBaseUrl - is used to modify the start of the OID4VC request URL. If you are using the
cross-device
flow, where you will display the URL as a QR code, you can leave the value as openid4vp://authorize or if you don't
know the wallet the user will be using to claim the credential. If you are using the same device flow, where you
already
know the user's wallet and want the user to be able to go directly to it, you can use the wallet URL path that is able
to
receive an OIDC request as a query parameter. Our wallet for example can receive OID4VC requests here
https://wallet.demo.walt.id/wallet-api/wallet/{wallet}/exchange/useOfferRequest.
responseMode - should be direct_post as the other options are not yet supported.
successRedirectUri (optional) - is used to redirect the user if verification is successful. You can use the $id
placeholder
to get access to the id of verification session in your application in order to retrieve the verification results.
E.g. /success?id=$id will be replaced with /success?id=1234567890
errorRedirectUri (optional) - is used to redirect the user if verification is unsuccessful. You can use the $id
placeholder
to get access to the id of verification session in your application in order to retrieve the verification results.
E.g. /error?id=$id will be replaced with /error?id=1234567890
statusCallbackUri (optional) - URL that should be called when the presentation request has been fulfilled by a
wallet. The request
sent will be a POST including the whole presentation
result. See Verification Status Policies Response
statusCallbackApiKey (optional) - If the endpoint you provide via statusCallbackUri is protected, you can use
the statusCallbackApiKey to authenticate.
The provided key will be appended as Authorization Header to the request.
stateId (optional) - overwrite the unique state value which gets created for each verification request with your
own.
openId4VPProfile (optional) - Define profile for VP (Verifiable Presentation) request. The default is W3C
OpenID4VP, which can optionally provided as DEFAULT.
Apart from that, you can choose from the following options:
EBSIV3: For EBSI V3 compliant VP. Learn more here.
ISO_18013_7_MDOC: For mdoc Openid4VP.
Body Parameters
request_credentials - An array of objects detailing the credentials to be requested from the user. Each object
varies based on the type of credential being requested.
Expand To Learn More
Below are the possible credential types and their respective object structures:
W3C JWT Credential
type Specifies the type of credential (e.g., VerifiableID, VerifiableDiploma). This maps to the type
attribute in W3C credentials.
format: Describes the format of the credential. For W3C JWT credentials, this would
be jwt_vc_json.
format: Describes the format of the credential. For SD-JWT VC credentials, this would be
vc+sd-jwt.: Describes the format of the credential. For SD-JWT VC credentials, this would be vc+sd-jwt.
In this example, we not only specify the types of credentials to verify, but also define the policies that should be
executed during verification:
VC policies (vc_policies): Applied to individual Verifiable Credentials (VCs).
VP policies (vp_policies): Applied to the Verifiable Presentation (VP) as a whole.
Default behavior: The signature policy is applied by default to both VP and VC(s).
Policy catalog: A list of available policies can be found
here.
How VC policies are applied:
Global scope: Once defined, VC policies are applied globally to all requested credentials in the verification
session.
Per-credential override: A later section shows how to customize and apply specific policies to individual
credentials when needed.
We specify policies in the verification request alongside the request_credentials parameter (previously explained),
using the vc_policies and vp_policies fields:
vc_policies and vp_policies each contain a list of policies; either one or both can be provided.
Identical structure: Both fields share the same structure.
Policy representation:
As a string if the policy does not require arguments.
As an object if the policy requires arguments.
Example Polices
[
"signature",
// policy without argument
"expired",
// policy without argument
"not-before",
// policy without argument
{
"policy": "webhook",
"args": "https://example.org/abc/xyz"
}
// policy with argument
]
authorizeBaseUrl - is used to modify the start of the OID4VC request URL. If you are using the
cross-device
flow, where you will display the URL as a QR code, you can leave the value as openid4vp://authorize or if you don't
know the wallet the user will be using to claim the credential. If you are using the same device flow, where you
already
know the user's wallet and want the user to be able to go directly to it, you can use the wallet URL path that is able
to
receive an OIDC request as a query parameter. Our wallet for example can receive OID4VC requests here
https://wallet.demo.walt.id/wallet-api/wallet/{wallet}/exchange/useOfferRequest.
responseMode - should be direct_post as the other options are not yet supported.
successRedirectUri (optional) - is used to redirect the user if verification is successful. You can use the $id
placeholder
to get access to the id of verification session in your application in order to retrieve the verification results.
E.g. /success?id=$id will be replaced with /success?id=1234567890
errorRedirectUri (optional) - is used to redirect the user if verification is unsuccessful. You can use the $id
placeholder
to get access to the id of verification session in your application in order to retrieve the verification results.
E.g. /error?id=$id will be replaced with /error?id=1234567890
statusCallbackUri (optional) - URL that should be called when the presentation request has been fulfilled by a
wallet. The request
sent will be a POST including the whole presentation
result. See Verification Status Policies Response
statusCallbackApiKey (optional) - If the endpoint you provide via statusCallbackUri is protected, you can use
the statusCallbackApiKey to authenticate.
The provided key will be appended as Authorization Header to the request.
stateId (optional) - overwrite the unique state value which gets created for each verification request with your
own.
openId4VPProfile (optional) - Define profile for VP (Verifiable Presentation) request. The default is W3C
OpenID4VP, which can optionally provided as DEFAULT.
Apart from that, you can choose from the following options:
EBSIV3: For EBSI V3 compliant VP. Learn more here.
ISO_18013_7_MDOC: For mdoc Openid4VP.
Body Parameters
vp_policies - Policies applied to the Verifiable Presentation. A list of policies can be
found here
vc_policies - Policies applied to all requested credentials. A list of policies can be
found here.
request_credentials - An array of objects detailing the credentials to be requested from the user. Each object
varies based on the type of credential being requested.
Expand To Learn More
Below are the possible credential types and their respective object structures:
W3C JWT Credential
type Specifies the type of credential (e.g., VerifiableID, VerifiableDiploma). This maps to the type
attribute in W3C credentials.
format: Describes the format of the credential. For W3C JWT credentials, this would
be jwt_vc_json.
format: Describes the format of the credential. For SD-JWT VC credentials, this would be
vc+sd-jwt.: Describes the format of the credential. For SD-JWT VC credentials, this would be vc+sd-jwt.
In this example, which builds up on the previous ones, we'll demonstrate how to apply specific policies to a distinct
credential in the verification process. This is achieved by specifying next to the required credential type and format,
the policies that should be applied as an array in the credential specification object which goes into the
requested_credentials array. A list of supported policies can be
found here.
In this code snippet, we extended the regular credential specification object that goes into request_credentials
to include policies that should be applied only to the "OpenBadgeCredential". The first policy "signature" doesn't
require any arguments and can therefore be provided as a string. The "webhook" policy does require an argument and is
therefore provided as an object. A list of different types of policies and their required arguments can be
found here.
Meanwhile, the other requested credentials, "VerifiableId" and "ProofOfResidence", don't specify and custom policies,
meaning they will be verified against the globally defined "vp_policies" and "vc_policies".
authorizeBaseUrl - is used to modify the start of the OID4VC request URL. If you are using the
cross-device
flow, where you will display the URL as a QR code, you can leave the value as openid4vp://authorize or if you don't
know the wallet the user will be using to claim the credential. If you are using the same device flow, where you
already
know the user's wallet and want the user to be able to go directly to it, you can use the wallet URL path that is able
to
receive an OIDC request as a query parameter. Our wallet for example can receive OID4VC requests here
https://wallet.demo.walt.id/wallet-api/wallet/{wallet}/exchange/useOfferRequest.
responseMode - should be direct_post as the other options are not yet supported.
successRedirectUri (optional) - is used to redirect the user if verification is successful. You can use the $id
placeholder
to get access to the id of verification session in your application in order to retrieve the verification results.
E.g. /success?id=$id will be replaced with /success?id=1234567890
errorRedirectUri (optional) - is used to redirect the user if verification is unsuccessful. You can use the $id
placeholder
to get access to the id of verification session in your application in order to retrieve the verification results.
E.g. /error?id=$id will be replaced with /error?id=1234567890
statusCallbackUri (optional) - URL that should be called when the presentation request has been fulfilled by a
wallet. The request
sent will be a POST including the whole presentation
result. See Verification Status Policies Response
statusCallbackApiKey (optional) - If the endpoint you provide via statusCallbackUri is protected, you can use
the statusCallbackApiKey to authenticate.
The provided key will be appended as Authorization Header to the request.
stateId (optional) - overwrite the unique state value which gets created for each verification request with your
own.
openId4VPProfile (optional) - Define profile for VP (Verifiable Presentation) request. The default is W3C
OpenID4VP, which can optionally provided as DEFAULT.
Apart from that, you can choose from the following options:
EBSIV3: For EBSI V3 compliant VP. Learn more here.
ISO_18013_7_MDOC: For mdoc Openid4VP.
Body Parameters
vp_policies - Policies applied to the Verifiable Presentation. A list of policies can be
found here
vc_policies - Policies applied to all requested credentials. A list of policies can be
found here.
request_credentials - An array of objects detailing the credentials to be requested from the user. Each object
varies based on the type of credential being requested.
Expand To Learn More
Below are the possible credential types and their respective object structures:
W3C JWT Credential
type Specifies the type of credential (e.g., VerifiableID, VerifiableDiploma). This maps to the type
attribute in W3C credentials.
format: Describes the format of the credential. For W3C JWT credentials, this would
be jwt_vc_json.
format: Describes the format of the credential. For SD-JWT VC credentials, this would be
vc+sd-jwt.: Describes the format of the credential. For SD-JWT VC credentials, this would be vc+sd-jwt.
In this example, we'll explore how you can provide your own input_descriptor that will be merged with the autogenerated
presentation definition.
You can specify your custom input_descriptor for the presentation definition
via an object in the request_credentials array, see example blow.
Important: Please also provide an id in the input_descriptor object.
On execution the verifier API will auto-generate the input descriptor for the VerifiableId credential that we specified via
the regular object and merge it with our custom input descriptor of the identity_credential to form the final presentation definition.
When using the input_descriptor make sure to also provide the presentation-definition policy in the
vp_policies array to ensure the constraints specified are checked during verification.
The presentation-definition policy also supports the
relational constraint feature.
It allows you to express relations between issuer, holder and multiple credentials
directly within the input_descriptor.
Use this constraint when you want to ensure that the credential was self issued
by the presenter. The verification will only succeed if the issuer DID matches the credential subject.
The is_holder option checks that a credential was issued to the same entity
that is presenting the verifiable presentation. Use it to bind specific fields
to the holder's DID.
Use same_subject when multiple credentials should refer to the same
underlying subject. The verifier compares the listed fields and only accepts the
presentation if they share an identical subject DID.
After the user presents the credential(s), you can verify the status by performing the following call with the
state value obtained from the URL query params you shared with the user previously.
After a successful presentation session (verificationResult is true), you can now get a decoded and formatted
view of all credentials presented by the holder.
You may choose between the following view modes:
simple - the go-to choice for most cases.
verbose - useful for debugging, auditing and other detailed technical information.
Endpoint:/openid4vc/session/{id}/presented-credentials | API Reference
viewMode - Echoed request value (or the default if it was not specified).
credentialsByFormat : A map where each key is a presentation format (jwt_vc_json, sd_jwt_vc, mso_mdoc)
and the value is an array of decoded presented credentials, formatted as JSON objects and whose properties vary
according to the value of viewMode:
For jwt_vc_json in simple view mode:
holder - Corresponds to the (optional) holder property of W3C verifiable presentations.
verifiableCredentials - Array of decoded JOSE-secured credentials that were included in the verifiable
presentation for each of which the JWT header and payload JSON objects are provided.
For jwt_vc_json in verbose view mode:
vp - JSON object that provides verbosely decoded JOSE-secured verifiable presentation and is
composed of
the following properties:
raw - The compact serialized verifiable presentation JWT.
header - The JWT header section of the verifiable presentation provided as a JSON object.
payload - The JWT payload section of the verifiable presentation provided as a JSON object.
verifiableCredentials - Array of verbose decoded JOSE-secured credentials that were included in the
verifiable presentation. Each entry in the array is a JSON object that is composed of the following properties:
raw - The compact serialized verifiable credential JWT.
header - The JWT header section of the verifiable credential provided as a JSON object.
fullPayload - The JWT payload section of the verifiable credential provided as a JSON
object with all disclosures (if provided) substituted.
undisclosedPayload - The JWT payload section of the verifiable credential provided as a JSON
object without any disclosures substituted (if provided).
disclosures - A map between selective disclosure (hashed) values and a JSON object that provides
their decoded representation as provided by the wallet. This property is only present if disclosable
claims were requested/provided in the context of the presentation session.
In the following we provide an example that involves the presentation of a University Degree W3C Verifiable Credential
with two disclosable claims, namely, the issuanceDate and credentialSubject.degree.name properties.