Interface Biometrics
-
- All Implemented Interfaces:
public interface BiometricsThe Biometrics interface provides methods for detecting biometric availability, registering, authenticating, and removing biometrics identifiers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBiometrics.RegisterParametersData class used for wrapping parameters used with Biometrics registration flow
public final classBiometrics.AuthenticateParametersData class used for wrapping parameters used with Biometrics authentication flow
public final classBiometrics.PromptDataData class used for wrapping parameters used to create a biometric prompt
-
Method Summary
Modifier and Type Method Description abstract BooleanisRegistrationAvailable(FragmentActivity context)Indicates if there is an existing biometric registration on device. abstract BiometricAvailabilityareBiometricsAvailable(FragmentActivity context, Boolean allowDeviceCredentials)Indicates if the biometric sensor is available, and provides a reasoning if not abstract BooleanremoveRegistration()Clears existing biometric registrations stored on device. abstract UnitremoveRegistration(Function1<Boolean, Unit> callback)Clears existing biometric registrations stored on device. abstract CompletableFuture<Boolean>removeRegistrationCompletable()Clears existing biometric registrations stored on device. abstract BooleanisUsingKeystore()Indicates if the device is device has a reliable version of the Android KeyStore. abstract StytchResult<BiometricsAuthData>register(Biometrics.RegisterParameters parameters)When a valid/active session exists, this method will add a biometric registration for the current user. abstract Unitregister(Biometrics.RegisterParameters parameters, Function1<StytchResult<BiometricsAuthData>, Unit> callback)When a valid/active session exists, this method will add a biometric registration for the current user. abstract CompletableFuture<StytchResult<BiometricsAuthData>>registerCompletable(Biometrics.RegisterParameters parameters)When a valid/active session exists, this method will add a biometric registration for the current user. abstract StytchResult<BiometricsAuthData>authenticate(Biometrics.AuthenticateParameters parameters)If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session. abstract Unitauthenticate(Biometrics.AuthenticateParameters parameters, Function1<StytchResult<BiometricsAuthData>, Unit> callback)If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session. abstract CompletableFuture<StytchResult<BiometricsAuthData>>authenticateCompletable(Biometrics.AuthenticateParameters parameters)If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session. -
-
Method Detail
-
isRegistrationAvailable
abstract Boolean isRegistrationAvailable(FragmentActivity context)
Indicates if there is an existing biometric registration on device.
- Parameters:
context- is the calling FragmentActivity- Returns:
Boolean
-
areBiometricsAvailable
abstract BiometricAvailability areBiometricsAvailable(FragmentActivity context, Boolean allowDeviceCredentials)
Indicates if the biometric sensor is available, and provides a reasoning if not
- Parameters:
context- is the calling FragmentActivityallowDeviceCredentials- whether or not you choose to allow the use of non-biometric device credentials (PIN, Pattern) as a fallback (on Android versions greater than Q)- Returns:
-
removeRegistration
abstract Boolean removeRegistration()
Clears existing biometric registrations stored on device. Useful when removing a user from a given device. Returns true if the registration was successfully removed from device.
- Returns:
Boolean
-
removeRegistration
abstract Unit removeRegistration(Function1<Boolean, Unit> callback)
Clears existing biometric registrations stored on device. Useful when removing a user from a given device. Returns true if the registration was successfully removed from device.
- Parameters:
callback- A callback that receives a Boolean
-
removeRegistrationCompletable
abstract CompletableFuture<Boolean> removeRegistrationCompletable()
Clears existing biometric registrations stored on device. Useful when removing a user from a given device. Returns true if the registration was successfully removed from device.
- Returns:
Boolean
-
isUsingKeystore
abstract Boolean isUsingKeystore()
Indicates if the device is device has a reliable version of the Android KeyStore. If it does not, there may be issues creating encryption keys, as well as implications on where these keys are stored. The safest approach is to not offer biometrics if this returns
false, but it is possible to force a registration with an unreliable KeyStore.- Returns:
Boolean
-
register
abstract StytchResult<BiometricsAuthData> register(Biometrics.RegisterParameters parameters)
When a valid/active session exists, this method will add a biometric registration for the current user. The user will later be able to start a new session with biometrics or use biometrics as an additional authentication factor.
- Parameters:
parameters- required to register a biometrics key- Returns:
BiometricsAuthResponse
-
register
abstract Unit register(Biometrics.RegisterParameters parameters, Function1<StytchResult<BiometricsAuthData>, Unit> callback)
When a valid/active session exists, this method will add a biometric registration for the current user. The user will later be able to start a new session with biometrics or use biometrics as an additional authentication factor.
- Parameters:
parameters- required to register a biometrics keycallback- a callback that receives a BiometricsAuthResponse
-
registerCompletable
abstract CompletableFuture<StytchResult<BiometricsAuthData>> registerCompletable(Biometrics.RegisterParameters parameters)
When a valid/active session exists, this method will add a biometric registration for the current user. The user will later be able to start a new session with biometrics or use biometrics as an additional authentication factor.
- Parameters:
parameters- required to register a biometrics key- Returns:
BiometricsAuthResponse
-
authenticate
abstract StytchResult<BiometricsAuthData> authenticate(Biometrics.AuthenticateParameters parameters)
If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session.
- Parameters:
parameters- required to authenticate a biometrics key- Returns:
BiometricsAuthResponse
-
authenticate
abstract Unit authenticate(Biometrics.AuthenticateParameters parameters, Function1<StytchResult<BiometricsAuthData>, Unit> callback)
If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session.
- Parameters:
parameters- required to authenticate a biometrics keycallback- a callback that receives a BiometricsAuthResponse
-
authenticateCompletable
abstract CompletableFuture<StytchResult<BiometricsAuthData>> authenticateCompletable(Biometrics.AuthenticateParameters parameters)
If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session.
- Parameters:
parameters- required to authenticate a biometrics key- Returns:
BiometricsAuthResponse
-
-
-
-