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

User's document ID

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

Logo

2023 © Caf. - All rights reserved