Using the scanResultBlob Object

Usage

The scanResultBlob is FaceTec's proprietary piece of encrypted data created by the FaceTec Server when processing a FaceScan or ID Scan. This data is passed back to the Device SDK as part of the FaceTec Server's JSON response.

The purpose of the scanResultBlob is to automatically control the Device SDK's logic flow once the FaceScan or ID Scan has been processed. In addition to containing other information, the scanResultBlob contains the result of whether a FaceScan or ID Scan succeeded or failed. Depending on the SDK being used, the scanResultBlob will either be passed into proceedToNextStep() or onFaceScanGoToNextStep(), where it is then processed by the SDK and used to determine the next step taken by the Device SDK.

The following APIs for manually controlling the Device SDK's logic flow have been deprecated for over 2 years, should not be used, and will be completely removed in an upcoming release:  faceScanResultCallback.succeed(), faceScanResultCallback.retry(), and faceScanResultCallback.cancel().

If you are using any of these older APIs,  please update your code to use the scanResultBlob as soon as possible. 


Example: Retrieving and Processing on Device SDK

Android SDK:

The scanResultBlob can be retrieved by using .getString("scanResultBlob") on the JSON response object. This is demonstrated in part 8 of the Sample App's LivenessCheckProcessor.

JSONObject responseJSON = new JSONObject(responseString);
boolean wasProcessed = responseJSON.getBoolean("wasProcessed");
String scanResultBlob = responseJSON.getString("scanResultBlob");

The following will process the logic flow from scanResultBlob and return its success as a boolean:

success = faceScanResultCallback.proceedToNextStep(scanResultBlob);

iOS SDK:

The scanResultBlob can be retrieved by accessing ["scanResultBlob"] in the JSON response object. This is demonstrated in part 6 of the Sample App's LivenessCheckProcessor.

guard let scanResultBlob = responseJSON["scanResultBlob"] as? String,
   let wasProcessed = responseJSON["wasProcessed"] as? Bool else {
   ...
   }

The following will process the logic flow from scanResultBlob and return its success as a boolean:

self.success = faceScanResultCallback.onFaceScanGoToNextStep(scanResultBlob: scanResultBlob)

Browser SDK:

The scanResultBlob can be retrieved by accessing .scanResultBlob on the JSON response object. This is demonstrated in part 5 of the Sample App's LivenessCheckProcessor.

var responseJSON = JSON.parse(_this.latestNetworkRequest.responseText);
var scanResultBlob = responseJSON.scanResultBlob;

The following will process the logic flow from scanResultBlob:

faceScanResultCallback.proceedToNextStep(scanResultBlob);

Example: Generating scanResultBlob on Customer FaceTec Server

The scanResultBlob is generated by calling livenessResult.getScanResultBlob(forceRetry), where forceRetry is a boolean dictating whether the Device SDK must be forced to retry its Face Scan or ID Scan.

The below is an example of scanResultBlob being generated in Custom Server's /src/main/java/com/facetec/customserver/Liveness3DProcessor.java:

boolean forceRetry = !faceScanSecurityChecks.isSuccess();
String scanResultBlob = livenessResult.getScanResultBlob(forceRetry);