This guide provides a comprehensive walkthrough for issuing a Verifiable Credential based on
the W3C standard
with a JWT or SD-JWT signature using the walt.id issuer API.
The issuance process will utilize the
OID4VCI protocol.
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 credentials and present them in a way that's consistent
and secure across platforms ensuring interoperability.
{
// The contextual information required for data integrity and 1.api
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1"
],
"id": "http://example.gov/credentials/3732",
// The credential's unique identifier
"type": [
"VerifiableCredential",
"UniversityDegree"
// Specifies the kind of credential being issued
],
"issuer": {
"id": "did:web:vc.transmute.world"
// The issuer's unique identifier (DID)
},
"issuanceDate": "2020-03-10T04:24:12.164Z",
// When the credential was issued
"credentialSubject": {
// Information about the credential's recipient and the degree earned
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "BachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
Note: Fields like issuer, issuanceDate, and credentialSubject.did are dynamic and will be populated with
actual
data upon issuance.
In this section, we'll generate a signing key which we store ourselves. For production
environments, we recommend using an external KMS provider for key management due to the enhanced security.
Learn more about the different types of keys and the storage options here.
As the issuer API doesn't store any cryptographic key material by default, you need to provide the key used for signing
the credential in one of the following ways:
JWK – the key is managed by you and provided directly in JWK format.
External KMS reference – a reference object that points to a key stored in a supported external KMS such as
Hashicorp Vault or
Oracle KMS.
In a production environment, we recommend using an external KMS provider to secure the key material.
To create keys and a related DID for signing credentials, you can use the /onboard/issuer endpoint and choose:
Key algorithms: ed25519, secp256k1, secp256r1, or RSA.
DID methods: did:key, did:jwk, did:web, or did:cheqd.
backend: String - Specifies the storage type of key. It can be jwk (manged by you), TSE (managed by
Hashicorp
Vault) and others. Learn more about different types here.
keyType: String - the algorithm used to generate the key. For local, it can
be ed25519, secp256k1, secp256r1, or RSA. For the other types and the supported algorithms, please
go here.
did:
method: String - Specifies the DID method. It can be key, jwk, web, cheqd.
Example Response
The onboard/issuer endpoint will return an object containing both the generated key in JWK format and the related DID.
As we've used the jwk key type, it's important to note that we need to save the returned values ourselves for future
reference.
The API doesn't save any information about created keys or DIDs.
Now, we'll issue a verifiable credential using the key and DID obtained (or any other supported JWK).
You can choose between the following signature types:
JWT – a JSON Web Token representation of the credential.
SD-JWT – a Selective-Disclosure JSON Web Token representation of the credential.
Learn more about Selective Disclosure here. In short, it enables your
users to only reveal a subset of the claims in a credential to a verifier when suitable. This increases privacy and
reduces the risk of identity theft and other types of fraud.
To facilitate the issuance of the credential from us (the issuer) to the holder, we will utilise the OID4VCI protocol.
In particular, we will be generating an OID4VC offer URL that can be accepted by any OID compliant wallet to receive
credential(s).
The credential offer URL specifies the credentials to be issued. This includes details such as
the URL of the issuer, the authorisation and token endpoints, and information about the credential's format, type, and
scope.
When we execute the issuance command, two things will happen:
The credential will be signed with the provided key and the chosen signature type (JWT or SD-JWT).
The information about the signed credential will be embedded into the OID Credential Offer URL, which we can send to
our users so they can claim the credential(s).
statusCallbackUri: URL - Receive updates on the created issuance process, e.g. when a credential was successfully
claimed. The parameter expects a URL which can accept a JSON POST request. The URL can also hold a $id, which will
be
replaced by the issuance session id. For example: https://myurl.com/$id, https://myurl.com
or https://myurl.com/test/$id
Expand To Learn More
Body
The data send to the provided URL will contain a JSON body:
id : String - the issuance session id
type: String - the event type
data: JsonObject - the data for the event
Event Types
Possible events (event types) and their data are:
resolved_credential_offer with the credential offer as JSON (in our Web Wallet: called when the issuance offer
is
entered into the wallet, but not processing / accepted yet)
requested_token with the issuance request for the token as json object (called for the token required to receive
the
credentials)
Credential issuance (called for every credential that's issued (= requested from wallet))
jwt_issue with jwt being the issued jwt
sdjwt_issue with sdjwt being the issued sdjwt
batch_jwt_issue with jwt being the issued jwt
batch_sdjwt_issue with sdjwt being the issued sdjwt
generated_mdoc with mdoc being the CBOR (HEX) of the signed mdoc
To allow for secure business logic flows, if a callback URL is set, and it cannot be reached, the issuance will not
commence further (after that point). If no callback URL is set, the issuance logic does not change in any way.
issuerKey: JSON - A JWK or reference object to a key stored in an external KMS to sign the credential with.
Supported algorithms: ed25519, secp256k1, secp256r1, or
RSA. JWK Format:{"type": "jwk", "jwk": Here JSON Web Key Object}. Must be provided as JWK object to "issuerKey". KMS Key: Please refer to the Key Management Section and the KMS you want to
use for more details on the structure
of the reference object.
issuerDid: String - The DID related to the provided key.
credentialConfigurationId: String - Reference to a specific credential configuration the issuer supports. As our
issuer currently supports W3C JWT & SD-JWT credentials and SD-JWT VCs (IETF). The structure of the
credentialConfigurationId is the following: "
credentialType_jwt_vc_json" for W3C JWT & SD-JWT credentials
and "credentialType_vc+sd-jwt" for SD-JWT VCs (IETF). E.g. "UniversityDegree_jwt_vc_json" or "
UniversityDegree_vc+sd-jwt".
You can also view
the credentialConfigurationIds by visiting the /.well-known/openid-credential-issuer endpoint of your issuer.
The metadata of our deployed issuer for testing can be
seen here.
credentialData: JSON - A credential data structure to sign (W3C compliant). A list of predefined valid structures
can be
found here.
mapping (optional): JSON - The mapping object that allows for dynamic value insertion via data functions,
executed at the time when the credentials is claimed. This feature enables personalized credentials based on real-time
data. Learn more about it and see a list of supported data functions here.
standardVersion: (optional) String - Defines which OIDC4VCI standard version is used. The supported standard versions are: DRAFT13 and DRAFT11. If no value is provided, it will default to DRAFT13.
authenticationMethod: (optional) String - Defines which OIDC4VC exchange flow is used (pre-auth or full-auth). If
no value is
provided, it will default to pre-auth flow indicated as PRE_AUTHORIZED. The parameter options are:
Expand To Learn More About The Options
PWD - used for authorization code flow with username/password authentication with external auth server
ID_TOKEN - used for authorization code flow with id_token authentication. When this method is used an authorization
request is sent to the wallet, which generates and issues the ID_TOKEN using its DID (
Decentralized Identifier). The issuer then verifies the ID_TOKEN to confirm the holder's identity and DID.
VP_TOKEN - used for authorization code flow with vp_token(OIDC4VP). With this method, the receiver of the
credential must be authenticated by presenting the requested credential. The credential which must be presented can
be configured using the vpRequestedValue as explained below. The policies which are applied to the presented credential
are 'signature,' 'expired,' and 'not-before.' Learn more about policies here.
NONE - used for authorization code flow with none authentication method
PRE_AUTHORIZED - used for pre-authorizated code flow
Additional parameters required for selected auth method:
For "ID_TOKEN" and "VP_TOKEN":
useJar: (Optional) Boolean - used for using JAR OAuth specification in the id/vp_token requests. If omitted, the
default value is true.
For VP_TOKEN:
vpRequestedValue: String - Specifies the requested credential type value for the VP token. E.g. "VerifiableId"
vpProfile: (Optional) String - Specifies the profile of the VP request. Available Profiles: DEFAULT: For W3C
OpenID4VP,
ISO_18013_7_MDOC: For MDOC OpenID4VP, EBSIV3: For EBSI V3 Compliant VP. If omitted, the default value is DEFAULT
Example Response
The issuer endpoint will respond with Credential Offer URL.