Request the Status of an Issued Verifiable Credential (VC)
Request the status of an issued Verifiable Credential (VC) using the BlockID SDK. As defined in the W3C Verifiable Credentials Data Model, the credential status property provides information about the current status of a verifiable credential, such as whether it is suspended or revoked.
The BlockID SDK allows users to request the status of credentials issued by 1Kosmos. Please see Request a Verifiable Credential (VC) for a Driver's License and Request a Verifiable Credential (VC) for an Employment Card for information on how to request an issued Verifiable Credential.
Prerequisites
Users first need to request a Verifiable Credential. Once a credential has been issued, users can request the status of an issued credential.
Please see the pages below for more information on how to request a verifiable credential for a Driver's License or Employment Card:
- Request a Verifiable Credential (VC) for a Driver's License
- Request a Verifiable Credential (VC) for an Employment Card
Once a credential has been issued, the credential will contain different parameters containing values. Only the string from the id
parameter of the issued credential is needed to check the status.
{
"vc": {
"@context": [
...,
],
"id":"did:blockid:442ac157-4fb2-4dd3-99b3-ee4306deb5d1", // This string is needed to check the status of the credential
...,
],
}
}
Request a Verifiable Credential (VC) Status for your Driver's License
Parameters
dns
: tenant domain as shown in the dashboardcommunityName
: tenant community as shown in the dashboardlicenseKey
: tenant license key as shown in the dashboardvcId
: theid
string from the issued Verifiable Credential to check the status of
Request Format
All requests are plug-and-play, not copy-paste. Please ensure that you are replacing the parameters in the request format below with the actual values
Please use the following format outlined below to request the status of an issued verifiable credential. In this example we are requesting the status of an issued Driver's License credental:
- NodeJS
- Java
- PHP
- Add dependencies and set tenant info
const BIDTenant = require("blockid-nodejs-helpers/BIDTenant.js");
const BIDVerifiableCredential = require("blockid-nodejs-helpers/BIDVerifiableCredential.js");
const tenantInfo = {
dns: "<tenant dns>",
communityName: "<community name>",
licenseKey: "<license key>",
};
- Request VC status
async function getVcStatusById(vcId) {
let vcStatus = await BIDVerifiableCredential.getVcStatusById(tenantInfo, vcId);
console.log("vcStatus::::::", JSON.stringify(vcStatus));
return vcStatus;
}
// Calling getVcStatusById function
getVcStatusById(<vcId>);
- Set tenant info
BIDTenantInfo tenantInfo = new BIDTenantInfo("<tenant dns>", "<community name>", "<license key>");
- Request VC status
BIDVCStatusResponse vcStatus = BIDVerifiableCredential.getVcStatusById(tenantInfo, "<vcId>"";
- Add dependencies and set tenant info
<?php
require_once("./BIDTenant.php");
require_once("./BIDVerifiableCredential.php");
$bidTenant = BIDTenant::getInstance();
$tenantInfo = array("dns" => "<tenant dns>", "communityName" => "<community>", "licenseKey" => "<license key>");
- Request VC status
$vcId = $documentVc['id'];
$vcStatusByIdResponse = BIDVerifiableCredential::getVcStatusById($tenantInfo, $vcId);
?>
Example Request
We've provided a complete example request below for reference:
The vcID shown here is taken from the Driver's License VC response Dummy information is provided in this example
- NodeJS
- Java
- PHP
const BIDTenant = require("blockid-nodejs-helpers/BIDTenant.js");
const BIDVerifiableCredential = require("blockid-nodejs-helpers/BIDVerifiableCredential.js");
let tenantInfo = {
dns: "blockid-trial.1kosmos.net",
communityName: "devx",
licenseKey: "9b074532-845b-4c75-ba3e-2b8950000000",
};
async function getVcStatusById(vcId) {
let vcStatus = await BIDVerifiableCredential.getVcStatusById(
tenantInfo,
vcId
);
console.log("vcStatus::::::", JSON.stringify(vcStatus));
return vcStatus;
}
getVcStatusById("did:blockid:442ac157-4fb2-4dd3-99b3-ee4306deb5d1");
BIDTenantInfo tenantInfo = new BIDTenantInfo("blockid-trial.1kosmos.net", "devx", "9b074532-845b-4c75-ba3e-2b89598ad405");
BIDVCStatusResponse vcStatus = BIDVerifiableCredential.getVcStatusById(tenantInfo, "did:blockid:442ac157-4fb2-4dd3-99b3-ee4306deb5d1");
<?php
require_once("./BIDTenant.php");
require_once("./BIDVerifiableCredential.php");
$bidTenant = BIDTenant::getInstance();
$tenantInfo = array("dns" => "blockid-trial.1kosmos.net", "communityName" => "devx", "licenseKey" => "9b074532-845b-4c75-ba3e-2b8950000000");
$vcId = "did:blockid:442ac157-4fb2-4dd3-99b3-ee4306deb5d1"
$vcStatusByIdResponse = BIDVerifiableCredential::getVcStatusById($tenantInfo, $vcId);
?>
Server Responses
Please review the responses below for expected output after requesting the status of an issued Verifiable Credential.
Dummy information is provided in this example
- 200
- 400
- 401
{
"result": {
"subject": {
"did": "did:2a651b36-c582-46cb-995c-f60380104c70",
"publicKey": "aRnlolY2VlKAgOsdB2zmry0YzfiXYDt5GrCYyZIX4ITkNpMMuoTR/rKHuzDr7hKBhwBnAm+6LGnyuPSY/WK9XQ=="
},
"type": [
"VerifiableCredential",
"DriversLicenseCredential"
],
"_id": "6396b97e028c790013b4c144",
"vcID": "did:blockid:442ac157-4fb2-4dd3-99b3-ee4306deb5d1",
"tenantId": "63627082d0b7e36525e281aa",
"communityId": "63627302d0b7e36525e2828d",
"proof": {
"type": "Ed25519Signature2020",
"created": "2022-12-12T05:17:50Z",
"verificationMethod": "did:key:blockid:z6MkvFNv22WzDetLgdzYidCFQJosD5Z9pDr9cmX7RtREuoji",
"proofPurpose": "assertionMethod",
"proofValue": "z3sMWYFHUZeo11jysZMX2f2dVpubJ47Li6uJHYBUYCWR8UjCp3wszbfy6ZBmy9YBj4HAw2kF6zDyagqsUh43zZrRh"
},
"issueTS": 1670822270,
"expiryTS": 1813449600,
"status": "issued",
"issuer": {
"id": "did:blockid:dmv:USA:WA"
}
}
}
{
"error_code": 400,
"message":"Invalid Request"
}
{
"error_code": 401,
"message":"Unauthorized"
}