For the complete documentation index, see llms.txt. This page is also available as Markdown.

Source Code

import UIKit
import CafFaceLivenessLite

final class MainViewController: UIViewController {
    private let sdk = CafFaceLivenessLiteSDK(enableSecurity: true)

    override func viewDidLoad() {
        super.viewDidLoad()
        sdk.delegate = self

        let startButton = UIButton(type: .system)
        startButton.setTitle("Start Liveness Lite", for: .normal)
        startButton.addTarget(self, action: #selector(startLivenessLite), for: .touchUpInside)
        view.addSubview(startButton)
        // Layout omitted
    }

    @objc private func startLivenessLite() {
        sdk.startSDK(
            viewController: self,
            mobileToken: "mobileToken",
            personId: "personId",
            customLocalization: nil,
            customLocalizationBundle: nil,
            environment: .prod,
            loading: true
        )
    }
}

extension MainViewController: CafFaceLivenessLiteDelegate {
    func didFinishWithSuccess(livenessResult: CafFaceLivenessLiteResult) {
        // Opaque JWT from async route — resolve final result on your backend
        print("Success: \(livenessResult.signedResponse ?? "-")")
    }

    func didFinishWithFailure(type: CafFailureType, description: String?, signedResponse: String?) {
        print("Failure: type=\(type) desc=\(description ?? "-") signed=\(signedResponse ?? "-")")
    }

    func didFinishWithError(type: CafErrorType, description: String) {
        print("Error: type=\(type) desc=\(description)")
    }

    func cancelled() { print("Cancelled") }
    func loading() { print("Loading") }
    func loaded() { print("Loaded") }
}

Last updated