showBiometricPrompt

suspend fun showBiometricPrompt(activity: FragmentActivity, title: String, subtitle: String, cryptoObject: BiometricPrompt.CryptoObject?, userAuthenticationTypes: Set<UserAuthenticationType>, requireConfirmation: Boolean): Boolean

Show the Biometric prompt

Async function that shows the Biometric Prompt and returns the result as a Boolean indicating whether authentication was successful, or raises/throws an Exception, such as IllegalStateException, if an error prevented the Biometric Prompt from showing.

Return

a Boolean indicating whether biometric authentication was successful.

Parameters

activity

the FragmentActivity hosting the authentication prompt.

title

the title for the authentication prompt.

subtitle

the subtitle for the authentication prompt.

cryptoObject

a crypto object to be associated with this authentication.

userAuthenticationTypes

the set of allowed user authentication types, must contain at least one element.

requireConfirmation

option to require explicit user confirmation after a passive biometric.

Throws

if there were errors showing the prompt.


fun showBiometricPrompt(activity: FragmentActivity, title: String, subtitle: String, cryptoObject: BiometricPrompt.CryptoObject?, userAuthenticationTypes: Set<UserAuthenticationType>, requireConfirmation: Boolean, onSuccess: () -> Unit, onCanceled: () -> Unit, onError: (Throwable) -> Unit)

Prompts user for authentication, and calls the provided functions when authentication is complete. Biometric authentication will be offered first if both UserAuthenticationType.LSKF and UserAuthenticationType.BIOMETRIC are allowed.

Parameters

activity

the FragmentActivity hosting the authentication prompt

title

the title for the authentication prompt

subtitle

the subtitle for the authentication prompt

cryptoObject

a crypto object to be associated with this authentication

userAuthenticationTypes

the set of allowed user authentication types, must contain at least one element

requireConfirmation

option to require explicit user confirmation after a passive biometric

onSuccess

the function which will be called when the user successfully authenticates

onCanceled

the function which will be called when the user cancels

onError

the function which will be called when there is an unexpected error in the user authentication process - a throwable will be passed into this function