PassiveFaceLiveness (Deprecated)

Smart camera that captures a reliable selfie of your user using artificial intelligence, capable of detecting and disapproving snapshots and recordings. Ideal for your onboarding.

Required permissions

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

Utilization

First, instantiate an object of type ** PassiveFaceLiveness:**

let passiveFaceLiveness = PassiveFaceLiveness.Builder(mobileToken: "mobileToken")
    // see the table below
    .build()

PassiveFaceLiveness.Builder

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

MessageSettings

After creating an object of type PassiveFaceLiveness, start the PassiveFaceLivenessController by passing this object as a parameter in the constructor:

let passiveVC = PassiveFaceLivenessController(passiveFaceLiveness: passiveFaceLiveness)
passiveVC.passiveFaceLivenessDelegate = self
present(passiveVC, animated: true, completion: nil)

Getting the result

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

class YouController: UIViewController, PassiveFaceLivenessControllerDelegate{
    
    // MARK: - Passive Faceliveness Delegates
    
    func passiveFaceLivenessController(_ passiveFacelivenessController: PassiveFaceLivenessController, didFinishWithResults results: PassiveFaceLivenessResult) {
        //Called when the process was successfully executed
        //The result variable contains the data obtained
    }
    
    func passiveFaceLivenessControllerDidCancel(_ passiveFacelivenessController: PassiveFaceLivenessController) {
        //Called when the process was canceled by the user
    }
    
    func passiveFaceLivenessController(_ passiveFacelivenessController: PassiveFaceLivenessController, didFailWithError error: PassiveFaceLivenessFailure) {
        //Called when the process terminate with an error
        //The error variable contains info about error
    }
}

PassiveFaceLivenessResult

PassiveFaceLivenessFailure

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 PassiveFaceLivenessLayout and passing it as a parameter to PassiveFaceLivenessBuilder:

let layout = PassiveFaceLivenessLayout()

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.setFont = UIImage(named: "my_font")

let passiveFacelivenessConfiguration = PassiveFaceLivenessBuilder(apiToken: "API_TOKEN")
    .setLayout(layout: layout)
    .build()

Last updated

Logo

2023 © Caf. - All rights reserved