FaceAuthenticator (Deprecated)

Plugin that calls native SDKs in Android and iOS.

Settings

In the file ROOT_PROJECT/android/app/build.gradle, add:

android {
    ...
    dataBinding.enabled = true
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

Import the package and call the add() method inside the initialization in android/app/src/main/java/io/ionic/starter/MainActivity.java:

import com.authenticator.FaceAuthenticatorPlugin;
public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    registerPlugin(FaceAuthenticatorPlugin.class);
  }
}

Importing

import { FaceAuthenticator } from "face-authenticator-plugin";

Using

let faceAuthenticator = await new FaceAuthenticator();
faceAuthenticator.setMobileToken = "<mobile token>";
faceAuthenticator.setPeopleId = "<cpf>";
//Enable video capture
let captureMode = new CaptureMode({
  videoCapture: new VideoCapture({ use: true, time: 3 }),
});
faceAuthenticator.setCaptureMode = captureMode;
const response = await faceAuthenticator.start();
if (response.result == "SUCCESS") {
  // Success. Check response.isAuthenticated and response.signedResponse
} else if (response.result == "FAILURE") {
  // Fault. Check reponse.type and response.message
} else {
  // User closed the screen.
}

General customizations

FaceAuthenticator

.setPeopleId(String peopleId)

CPF of the user who is using the plugin to be used for fraud detection via analytics

.setAnalyticsSettings(bool useAnalytics)

Enables/disables data collection for maximizing anti-fraud information. Default is true.

.enableSound(bool enable)

Enables/disables sounds. Default is true.

.setNetworkSettings(int requestTimeout)

Change the default network settings. The default is 60 seconds

.setAndroidSettings(AndroidSettings androidSettings)

Customizations only applied on Android

.setIosSettings(IosSettings iosSettings)

customizations only applied on iOS

.setCaptureMode(CaptureMode captureMode)

Define the capture settings

CaptureMode

videoCapture: VideoCapture(use: boolean, time: number)

Configura a captura por vΓ­deo

imageCapture: ImageCapture(use: boolean, beforePictureMillis: number, afterPictureMillis: number)

Configura a captura por foto

Example of use

let imageCapture = new ImageCapture({ use: true });
let captureMode = new CaptureMode({ imageCapture: imageCapture });
faceAuthenticator.setCaptureMode = captureMode;

Getting the result

The FaceAuthenticator return object will have the result attribute that contains a string SUCCESS, FAILURE or CLOSED. The return will default to PassiveFaceLivenessSuccess, PassiveFaceLivenessFailure, and PassiveFaceLivenessClosed, respectively, for each of the cases.

FaceAuthenticatorSuccess

FieldDescription

Boolean isAuthenticated

Full address of the image on the device

String signedResponse

Signed response from the CAF server which confirmed that the captured selfie has a real face (not a photo or video). Use this parameter if you want an extra layer of security by checking that the signature of the response is not broken, caused by an intercepted request. If it is broken, there is a strong indication of request interception

String trackingId

Identifier of this execution on our servers. If possible, save this field and send it along to our API. This way we will have more data on how the user behaved during the execution. Will be null if the user sets useAnalytics = false or the analytics calls do not work

FaceAuthenticatorFailure

Field

String message

Friendly message explaining why the SDK failed

String type

Fault type that shut down the SDK

Os tipos de falha existentes sΓ£o:

FieldDescription

InvalidTokenReason

When the token entered is invalid. Should not occur in a production environment.

PermissionReason

some mandatory permission was not granted by the user. It will only happen in a production environment if your app does not ask your user or the user manually disables it before starting.

NetworkReason

Server connection failure. Will occur in production if the user's device is without internet.

ServerReason

Failure in some request with our servers. It will occur in production only in case of our failure.

SecurityReason

When the device is not safe to run the SDK. If this failure occurs, let us know.

StorageReason

When the device does not have enough space for capturing some of the photos. Can occur in production.

LibraryReason

some internal failure made it impossible to run the SDK. It may occur due to project configuration errors, it should not occur in production.

FaceAuthenticatorClosed

Empty object indicating closure of the capture screen by the user.

Last updated

Logo

2023 Β© Caf. - All rights reserved