Passkey

The Kotlin Android Passkey module ensures secure and streamlined user authentication and registration using modern passkey technology. It provides a set of methods to verify a user’s existence, authenticate users, and register new users.

1. isUserExist

The isUserExist() method checks whether a user with the provided username already exists in the system. It returns a Flow emitting a Boolean value indicating the existence status.

Example:

    fun main() {
    // Check if the user "john_doe" exists
        isUserExist("john_doe").collect { exists ->
            println("User exists: $exists")
        }
    }

2. authenticate

The authenticate() method initiates the passkey authentication process for a user. It accepts the username and the activity context to start the authentication flow. The method returns a Flow that emits an AuthVerifyResponse containing details of the authentication result.

Example:

fun main() {
    // Authenticate user "john_doe" within the current activity context
    authenticate("john_doe", this).collect { response ->
        println("Authentication successful: $response")
    }
}

3. register

The register() method starts the passkey-based registration process for a new user. It takes the username and the activity context, then returns a Flow emitting a RegisterVerifyResponse with the registration details.

Example:

fun main() {
    // Register a new user "john_doe"
    register("john_doe", this).collect { response ->
        println("Registration successful: $response")
    }
}

Last updated