Skip to main content

Verification

BLOOCK's identity product allows you to act as verification agents as well. Once our users or holders have their credentials, they will want to be able to verify themselves.

At this point, you have two options:

  1. Using external verifiers.
  2. Create your own verifier through BLOOCK.

If you want to use our verification process, here is how it works:

  1. You must create a request, which is nothing more than a QR code to show to the user or Holder you want to verify. In order to create the request you need to create a Validation Query. This functionality is available in our dashboard.
  2. Then, you will have to wait for your Holder to scan the request with its wallet or software and generate the proof on your request.

    It is important to note that within the request that you will show to your Holder, you can specify what things you want to validate. For example, you can determine that you only want to verify that it holds a credential of the type BloockEmployee or you can verify something more specific, such as that your employee's date of birth is less than 2000.

  3. Once you receive the proof from the Holder, it will be verified, and you will get a result of true or false, verified or not verified. The BLOOCK verification process establishes a customizable logic, adding an expiration time to the requests, by default 60 min. This means that when the request is created it will be invalidated after 60 min. If the user was already verified, after 60 minutes it will have to be verified again.

Examples

import { Bloock, IdentityClient } from '@bloock/sdk';

try {
// we set the API key and create a client
Bloock.setApiKey(process.env['API_KEY'] || "");
// we set de identity managed API host you have deployed
Bloock.setIdentityApiHost(process.env['IDENTITY_MANAGED_API_HOST'] || "");

// initialize the IdentityClient
const identityClient = new IdentityClient();

// first you will need to get the proof request, it's basically a json string, you can generate this using our Dashboard Validation Queries.
const proofRequest = `{"id":1708674709,"query":{"type":"BloockEmployee","context":"https://api.bloock.com/hosting/v1/ipfs/QmadTvnNKvj2fBDgen35uAp1TfP9pSPVCNeDWw4fitqqne","allowedIssuers":["*"],"credentialSubject":{"number":{"$lt":5}},"skipClaimRevocationCheck":false},"circuitId":"credentialAtomicQuerySigV2"}`;

// we call the create verification function, using our proof request. This would create a verification process (by default with an expiration of 60min)
const verification = await identityClient.createVerification(proofRequest);

console.log(verification.sessionID) // the session id it's the integer identifier for you verification process, you will need to save it, to then check the status
console.log(verification.verificationRequest) // // the json that you need to convert to QR code, so you user could scan and be verified

// we can call the wait verification function in order to paused until the verification is made (use this function to have a synchronous process)
const verOK = await identityClient.waitVerification(verification.sessionID); // By default 120000 seconds, you can customize
if (!verOK) {
throw new Error("Error waiting for the verification");
}

// finally to check the verification status and to know if the verification was success, you can call this function
const verified = await identityClient.getVerificationStatus(verification.sessionID);
if (!verified) {
throw new Error("Verification failed");
}

console.log("Successfully verified")

} catch (e) {
console.log(e);
}