Capturing Digital ID
Introduction
OneSDK will allow you to specify whether an ID image is digital or not when running OCR. Some states and ID types in Aus are provided with a digital version as well, which users can use during onboarding.
Digital ID (Driver's license) capture availability
This feature is only available only for New South Wales (NSW) Driver's License, and only for a specific IDV provider. Please contact support.
Enabling digital Drivers' License capture
To use this feature, a new flag, digital
for a particular document type, should be set to true
when you create an ocr
component. Once set, you can provide an image, or screenshot, of the digital version of the ID to the input_required
event.
You can set the value of this flag every time that you run OCR, based on the user input:
- If user has chosen digital ID, it needs to be set to
true
. - If user wants to use a physical version of the ID, it needs to be set to
false
.
The default value is false
.
Sample code
The following code example implements the ocr
component and the input_required
listener that supports passports and digital driver's licences.
const ocr = oneSdk.component("ocr", {documents: [{type: "DRIVERS_LICENCE", digital: true}]});
ocr.on("input_required", async (inputInfo, status, provideFile) => {
const { documentType, side } = inputInfo;
// documentType will initially be null, until the type is inferred from the first provided scan
if (documentType === "PASSPORT") {
// present UI to capture a passport image
} else if (documentType === "DRIVERS_LICENCE") {
// check which side of the drivers licence is required
if (side === "front") {
// present UI to capture the licence's front side
} else if (side === "back") {
// present UI to capture the licence's back side
}
} else {
// present UI to capture any type of identity document
}
// Your use interface you should capture an image and provide it to OneSDK as a File object.
// https://developer.mozilla.org/en-US/docs/Web/API/File
//
// For example, your interface may use the Image Capture API to obtain the image data, though use of this API is not required.
// See https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Image_Capture_API
// const blob = // ...
// provideFile(blob)
// example of capturing a blob image from browser
navigator.mediaDevices.getUserMedia({ video: true }).then((mediaStream) => {
// Do something with the stream.
const track = mediaStream.getVideoTracks()[0];
let imageCapture = new ImageCapture(track);
imageCapture.takePhoto().then((file) => provideFile(file));
});
});
For further information on performing OCR and Biometrics with OneSDK, visit OneSDK for OCR and Biometrics.
Updated 4 months ago