FaceAuthenticator (Deprecated)

Facematch with proof of life from your app's user, ideal for login flows or valuable financial transactions.

Required permissions

In the info.plist file, add the permissions below:

Utilization

First, instantiate an object of type FaceAuthenticator:

let faceAuthenticator = FaceAuthenticator.Builder(mobileToken: "mobileToken")
    // see the table below
    .build()

FaceAuthenticator.Builder

Each environment (beta and production) requires its own specific mobileToken, generated in the Trust platform of the respective environment.

After creating the FaceAuthenticator type object, you can start the FaceAuthenticatorController by passing it as a parameter in the constructor:

let faceAuthController = FaceAuthenticatorController(faceAuthenticator: faceAuthenticator)
faceAuthController.faceAuthenticatorDelegate = self
present(faceAuthController, animated: true, completion: nil)

Getting the result

To get the result, you must implement the FaceAuthenticatorControllerDelegate delegate in your controller:

class YouController: UIViewController, FaceAuthenticatorControllerDelegate{
    
    // MARK: Delegates Face Auht
    
    func faceAuthenticatorController(_ faceAuthenticatorController: FaceAuthenticatorController, didFinishWithResults results: FaceAuthenticatorResult) {
        //Called when the process was successfully executed
        //The result variable contains the data obtained
    }
    
    func faceAuthenticatorControllerDidCancel(_ faceAuthenticatorController: FaceAuthenticatorController) {
        //Called when the process was canceled by the user
    }
    
    func faceAuthenticatorController(_ faceAuthenticatorController: FaceAuthenticatorController, didFailWithError error: FaceAuthenticatorFailure) {
        //Called when the process terminate with an error
        //The error variable contains info about error
    }
}

FaceAuthenticatorResult

FaceAuthenticatorFailure

Superclass that leads to the SDK shutdown. To find out what the reason was, find out which object class has the isKindOfClass() method, equivalent to instanceof in Java and is in Dart:

Examples

Customizing the Layout

You can customize the layout by creating an object of type FaceAuthenticatorLayout and passing it as a parameter to the FaceAuthenticatorBuilder:

let layout = FaceAuthenticatorLayout()

layout.changeMaskImages(
    greenMask: UIImage(named: "my_green_mask"),
    whiteMask: UIImage(named: "my_white_mask"),
    redMask: UIImage(named: "my_red_mask"))

layout.changeSoundImages(soundOn: UIImage(named: "my_sound_on_image"),
                        soundOff: UIImage(named: "my_sound_off_image"))

layout.closeImage = UIImage(named: "my_close_image")
layout.buttonSize = CGFloat(50)
layout.buttonContentMode = .scaleAspectFill

let faceAuthenticatorConfiguration = FaceAuthenticatorBuilder(apiToken: "API_TOKEN")
    .setLayout(layout: layout)
    .build()

Last updated

Logo

2023 © Caf. - All rights reserved