Skip to main content

Passport Verification

BlockID Passport Verify allows developers to quickly and accurately confirm the identity information on a user's passport. Our helper SDKs can be integrated into your development environment and add this functionality in a few simple steps.

Using our helper SDKs, developers can initiate the passport verification process by sending an SMS containing a URL (and matching session) to our web-based application. Users follow the instructions on the application to take a photo of the ID page of their passport, followed by a selfie photo.

Please see our Passport Verification Demo Application in our developer sandbox for a hands-on demo of the passport verification process. This article is focused on configuring the backend to create the session and URL that users will use to access the passport verification scan.

Create a new Passport Verification Session

Parameters

  • dns: tenant domain as shown in the dashboard
  • communityName: tenant community as shown in the dashboard
  • licenseKey: tenant license key as shown in the dashboard
  • dvcId: tenant document verification configuration as shown in the dashboard
  • documentType: set as ppt_object
  • smsTo: phone number, including area code
  • smsISDCode: international subscriber dialing code of the phone number
  • smsTemplateB64: base64-encoded SMS message to send, along with the URL to initiate the web-based passport scan (see example below)
  • sessionId: session ID returned by the API server for the passport scan

Request Format

tip

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

First, we need to create a new session for passport verification. We've outlined the request format.

  • Set tenant info and document verification configuration (dvcID)
const BIDVerifyDocument = require('blockid-nodejs-helpers/BIDVerifyDocument');
const BIDMessaging = require('blockid-nodejs-helpers/BIDMessaging');
const dvcId = "<dvcId>";
const documentType = "ppt_object";

const tenantInfo = {
dns: "<tenant dns>",
communityName: "<community name>",
licenseKey: "<user license key>"
}
  • Define the SMS message to send to users with the URL to initiate the passport verification web application
const sample_sms_template = "Hello Developer, please complete your document verification scan for Company Name by visiting <link>"
tip

The <link> parameter is just a placeholder and will be replaced with the actual URL below

  • Create a session and generate a URL to initiate the web-based passport verification
async function createSessionAndTriggerSMS() {
let createdSessionResponse = await BIDVerifyDocument.createDocumentSession(tenantInfo, dvcId, documentType);

// Replace the URL placeholder in sms template.
console.log('createdSessionResponse:', createdSessionResponse);

const templateText = sample_sms_template
.toString()
.replace(/<link>/, createdSessionResponse.url);
const smsTemplateB64 = Buffer.from(templateText).toString('base64');

// Trigger SMS with DL Scan link to the provided phone number
let smsResponse = await BIDMessaging.sendSMS(tenantInfo, smsTo = "<smsTo>", smsISDCode = "<smsISDCode>", smsTemplateB64);
}
  • Start polling session for passport verification, start face compare when SUCCESS is returned
note

The polling function will run until a SUCCESS status is returned. See example polling responses

async function pollSession(sessionId) {

// Start poll session for passport scan + Live Id verification Response
let pollSessionResponse = await BIDVerifyDocument.pollSessionResult(tenantInfo, dvcId, sessionId);
console.log('pollSessionResponse:', pollSessionResponse);

// After receiving Success Response, start face_compare of passport image and liveid image
if (documentResponse.responseStatus === "SUCCESS") {
let document = {
id: pollSessionResponse.liveid_object.id,
type: "ppt",
image1: pollSessionResponse.ppt_object.face,
image2: pollSessionResponse.liveid_object.face,
purpose: "ppt_verification"
};

const faceCompareResponse = await BIDVerifyDocument.verifyDocument(tenantInfo, dvcId, ["face_compare"], document);
console.log('faceCompareResponse::', faceCompareResponse);
}
}
  • Create session and trigger SMS
createSessionAndTriggerSMS();

Example Request

tip

Dummy information is provided in this example

const BIDVerifyDocument = require('blockid-nodejs-helpers/BIDVerifyDocument');
const BIDMessaging = require('blockid-nodejs-helpers/BIDMessaging');
const dvcId = "devx_57010000-ea00-4500-ab00-b86d22000000";
const documentType = "ppt_object";
const tenantInfo = {
dns: "blockid-trial.1kosmos.net",
communityName: "default",
licenseKey: "00000000-0000-0000-0000-000000000000"
}

//Define SMS message
const sample_sms_template = "Hello Developer, Please complete your document verification scan for Company by visiting <link>"

// Create verification session and URL
async function createSessionAndTriggerSMS() {
let createdSessionResponse = await BIDVerifyDocument.createDocumentSession(tenantInfo, dvcId, documentType);

// Switch URL placeholder with actual verification link in sms template
console.log('createdSessionResponse:', createdSessionResponse);

const templateText = sample_sms_template
.toString()
.replace(/<link>/, createdSessionResponse.url);
const smsTemplateB64 = Buffer.from(templateText).toString('base64');

// Trigger SMS with verification link to the provided phone number
let smsResponse = await BIDMessaging.sendSMS(tenantInfo, smsTo = "1234567890", smsISDCode = "1", smsTemplateB64);
return createdSessionResponse;
}


// Start poll session for passport scan + Live Id verification Response
async function pollSession(sessionId) {
let pollSessionResponse = await BIDVerifyDocument.pollSessionResult(tenantInfo, dvcId, sessionId);
console.log('pollSessionResponse:', pollSessionResponse);

// After receiving Success Response, start face_compare of passport image and liveid image
if (documentResponse.responseStatus === "SUCCESS") {
let document = {
id: pollSessionResponse.liveid_object.id,
type: "ppt",
image1: pollSessionResponse.ppt_object.face,
image2: pollSessionResponse.liveid_object.face,
purpose: "ppt_verification"
};

const faceCompareResponse = await BIDVerifyDocument.verifyDocument(tenantInfo, dvcId, ["face_compare"], document);
console.log('faceCompareResponse::', faceCompareResponse);
}
}

var sessionResponse = createSessionAndTriggerSMS();
await pollSession(sessionResponse.sessionId)

Server Responses

tip

Responses include dummy data as an example of a typical response

A successful request should return a session ID, along with the URL that users should visit on their mobile device to initiate the passport verification scan.

Passport Verification Responses

200 OK

{
"url": "https://multieastt.reauthid.com/MWA/index.html?token=c575f661-905f-49d9-bcf9-261ca0000000",
"sessionId": "c575f661-905f-49d9-bcf9-261ca0000000"
}

The API accepted the request and has returned a session ID and link to initiate the document verification process.

Polling Function Responses

SUCCESS
{
"responseStatus": "SUCCESS",
"sessionId": "0acc3890-7df9-4867-afda-0b5000000000",
"ppt_object": {
"type": "ppt",
"documentType": "Passport",
"category": "identity_document",
"documentId": "Y07PMRMJ6",
"id": "Y07PMRMJ6",
"firstName": "VIIALI",
"lastName": "MLIMSCHO",
"dob": "Invalid date",
"doe": "Invalid date",
"face": "fgRuQ1Lqkcn3cni76M77ER9iBfYNQ5vwf0qfPvHyWFiMAAAAASUVORK5CYII=",
"image": "",
"country": "DEU"
},
"liveid_object": {
"id": "com.blockid.liveid",
"type": "liveid",
"category": "identity_document",
"face": "fgRuQ1Lqkcn3cni76M77ER9iBfYNQ5vwf0qfPvHyWFiMAAAAASUVORK5CYII="
},
"token": "iVBORw0KGgoAAAAN/SUhEUgAAACAAAAAg="
}

Face Compare Responses

{
"docId": "com.blockid.liveid",
"docType": "ppt",
"certifications": [
{
"docType": "ppt",
"docId": "com.blockid.liveid",
"type": "face_compare",
"ts": 1651751289793,
"verified": true,
"result": {
"id": "com.blockid.liveid",
"type": "ppt",
"category": "identity_document",
"confidence": 0.9920617938041687,
"minScore": 0.9
},
"metadata": {
"transactionId": "f4b48944-5476-430e-9487-291c612b990b",
"similarity": 0.9920617938041687
},
"token": "BZevuyUqEN4pUEJWMnhrPWiZyiAI+Il1FsrZNPzUqG5RjAKb5bVRdTGnl2LW/QOKE3YL+Aj4vegHOOQN9hFZssfuWKgNtHIEbST2uH7AqTbuW6CU+Ckli4SZTz75FGbSCDC38VmsdVlhCw+UVMExLq9Hb3J6u8oFyaA/HVuuxj0qo3CABXx/YEPv/8M/r0Ehn4IJuausX+aBap5z0iLCMfGrrphWy55KrbOiJj4bQfcqmtIkq2CqZHWA0l06oN9lw+hVUeyRdYYz0hIrhsazbT4NBQ4lEwXFc8SqrTSOLpQsgn3n3Hx7gbNmG0idD4wp2ZDy5NNoN7LmpahvUeFkYIBNscY5r16XoZmeRjYlwUZpc1cUJdRPQbGnu2f53M+Rhg3y5m4wIXRdMjkn+b6u8/fROp1O52jRRrrm2WNnb4OZhV3lryNPi9H6wc+58qvpfWcKu0BN0qobrAOm1//fp/X98446oSHMnDpXWM6yCGa/4A=="
}
]
}