Receive a credential
Learn how to receive a credential.
The issuance workflow for wallets has three steps:
Handle invitation
Get credential
Respond to the offer
This page explains each step and how to complete them. Samples for the Desk API (for organizational wallets) and for the SDK (for mobile devices) are provided.
Issuance workflow for wallets
Handle invitation
The issuer will share an invitation URL, often encoded as a QR code. The URL is generated from the issuance protocol; your system must support the issuance protocol used to be able to parse the offer correctly.
Related guide: Configure OID4VCI for wallets
Use the "Handle invitation" endpoint to parse the invitation URL:
- API
- React Native
curl -L -X POST '/api/interaction/v1/handle-invitation' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"url": "https://example.com/invitation"
}'
const invitationUrl = 'https://example.com/invitation' // Get invitation URL from QR code or deep link
const invitation = await core.handleInvitation(invitationUrl, organisationId),
This endpoint takes an invitation URL from the issuer and retrieves the offer, returning two things:
- Interaction ID: this is a reference for the newly created interaction. You will use this ID when you later respond to the offer.
- Credential IDs: this is an array of IDs representing the offered credentials. You can look up details of the offered credentials but they are not yet issued to the wallet.
Transport array
If you have multiple transport protocols configured you can use this array to override the default protocol. For wallets, this is generally only the case for mobile devices.
Get credential
To see the offer, look up the credential:
- API
- React Native
curl -L '/api/credential/v1/{credentialId}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
const { interactionId, credentialIds } = invitation;
const credentialId = credentialIds[0];
const credential = await core.getCredential(credentialId);
Respond to offer
Review the offered credential and either accept it or reject it.
Accept offer
Choose an identifier to use to accept the credential — the identifier becomes part of the issued credential and will need to be used again when you present the credential to a verifier.
Choosing an identifier
Check the following capabilities for a report of which identifiers and associated key algorithms can be used with the format of the credential you want to accept:
holderIdentifierTypes
holderKeyAlgorithms
holderDidMethods
- API
- React Native
curl -L -X POST '/api/interaction/v1/issuance-accept' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"identifierId":"{{CHOOSE-IDENTIFIER}}",
"interactionId":"{{FROM-HANDLE-INVITATION}}"
}'
await core.holderAcceptCredential(interactionId, identifierId);
Reject offer
- API
- React Native
curl -L -X POST '/api/interaction/v1/issuance-reject' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"interactionId":"{{FROM-HANDLE-INVITATION}}"
}'
await core.holderRejectCredential(interactionId);