Parsing Responses

Authentic ID provides this SDK to our customers who wants to build the ID Proofing workflow in their existing or new applications. The primary role of this SDK is to ensure the best quality image capture for Govt. issued identity cards (DL, Passport book, Passport card).

To achieve the most optimal results, we have a 3 step approach, which can make it easy for your consumers to capture the image and at the same time ensure the image quality is pristine to help Authentic ID server side API ensure the proper decision making.

Important

As part of receiving the response from our SDK, you will need to implement the necessary delegate methods. Each of the below steps occurs within the handleScan(result: DSResult) function. If you are not yet familiar with this, you may want to start with Initial Integration.

Within the handleScan(result: DSResult) delegate method, it is up to you to determine if the capture was successful or not. Since client use cases vary greatly over the market, it is not possible to contain this logic within the SDK.

Step 1: Extract an Image

It is our recommendation that only uncropped images are submitted to our APIs to maximize the effectiveness of our decisioning process.

Depending on which images you decide to use, you must inform the AuthenticID API whether the image is cropped via the AutoCrop header. The images that are returned within the DSResult object are as follows:

Property

Description

Image Cropped?

AutoCrop Value

croppedImage

The cropped image (no flash)

True

False

croppedFlashImage

The cropped flash image

True

False

uncroppedImage

The uncropped image (no flash)

False

True

uncroppedFlashImage

The uncropped flash image

False

True

image

The best non-flash image chosen by the SDK (cropped or not)

Dynamic

Dynamic

flashImage

The best flash image chosen by the SDK (cropped or not)

Dynamic

Dynamic

Step 2: Unpack DSResult

A DSResult also contains a detailed capture analysis. Combined with the image data, these fields allow you to decide which images, if any, are valid for processing.

Property

Description

isImageCropped

Indicates if the SDK was able to crop the non flash image or not

isFlashImageCropped

Indicates if the SDK was able to crop the flash image or not

confidence

Indicates SDK’s confidence level on the image quality. Value ranges between 0 and 1. Recommended 0.60 +

captureAnalysis.distanceConfidence

Indicates SDK’s confidence level on the distance between the camera and Document. Value ranges between 0 and 1. Recommended 0.60 +

captureAnalysis.faceDetected

Indicates if the SDK could see a human face in the document image.

Step 3: Decisioning

It is up to consuming applications to determine the best decisioning model as it pertains to each use case. That being said, the general implementation flow is as follows:

First, determine if images are uncropped:

if result.uncroppedImage != nil {
    // uncropped image present
}

if result.uncroppedFlashImage != nil {
    // uncropped flash image present
}

Then, check for distance confidence:

if result.confidence < 0.6,
    result.captureAnalysis.distanceConfidence < 0.6 {
    // document is not well-centered in the frame
}

The confidence scores may differ per use case, so client code may need to be dialed-in as needed.

If you don’t need to know the quality of the document position, then you can simply check for confidence:

    // already confirmed we have uncropped image
if result.confidence < 0.6 {
    // Image quality is not good
}

if result.confidence > 0.6 {
    // Image quality is good
}

Tracking State in a Capture Workflow

In order to keep track of how many times a user goes through the license or passport scan process, there needs to be a mechanism that tracks the state of the workflow. Once a user exceeds the specified amount of retries, the workflow should send the last image taken, in order to see if the server can do anything with it. For example, our SDK might not be able to read newer barcodes, but the server has updates which can easily read it. By eventually sending an image to the server, we can have a higher probability of success.

Create, or modify, a state machine to replicate the flow described in the figure below. Use a variable, such as rescanCount, to keep track of the number of times a user has to retake an image due to processing failure. If the user exceeds the maximum number of retries (totalAttempts), then the image should be sent to the server for an attempt at processing. If the user manually selects to retake the picture, then the rescanCount is not incremented.

retake-flow-diagram