Start Smart Authentication

Calling verifyPolicy

To start the liveness verification, use the startSDK() method with the user's document ID, your account mobile token and CafVerifyPolicyListener interface.

Parameter
Type
Description
Required

mobileToken

String

Usage token associated with your CAF account

personId

String

Identifier of the user who will perform the face liveness verification. It's recommended to use the user's identification document in this field, such as their CPF (Brazilian document ID), but it could be any other value.

listener

Interface which handles key events during the SDK's liveness detection process:

Example

    private fun startSdk() {
        smartAuth.verifyPolicy(
            "userDocument",
            "myPolicyId",
            setupListener()
        )
    }

    private fun setupListener() = object : CafVerifyPolicyListener {
        override fun onSuccess(
            isAuthorized: Boolean,
            attemptId: String?,
            attestation: String?
        ) {
            println("CafVerifyPolicyListener.onSuccess isAuthorized: $isAuthorized")
            println("CafVerifyPolicyListener.onSuccess attemptId: $attemptId")
            println("CafVerifyPolicyListener.onSuccess attestation: $attestation")
        }

        override fun onPending(isAuthorized: Boolean, attestation: String) {
            println("CafVerifyPolicyListener.onPending isAuthorized: $isAuthorized")
            println("CafVerifyPolicyListener.onPending attestation: $attestation")
        }

        override fun onError(failure: CafFailure) {
            println("CafVerifyPolicyListener.onError failure: ${failure.message}")
        }

        override fun onCancel() {
            println("CafVerifyPolicyListener.onCancel")
        }

        override fun onLoading() {
            println("CafVerifyPolicyListener.onLoading")
        }

        override fun onLoaded() {
            println("CafVerifyPolicyListener.onLoaded")
        }
    }

Last updated