3️⃣ Authentication
Authentication is the biometric equivalent of "signing-in". During authentication Keyless compares the user's facial biometrics with the ones computed during enrollment.
If the biometrics match, Keyless authenticates the user.
val configuration = BiomAuthConfig()
Keyless.authenticate(
configuration = configuration,
onCompletion = { result ->
when (result) {
is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "Authentication success")
is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Authentication failure - error code ${result.error.code}")
}
}
)let configuration = BiomAuthConfig()
Keyless.authenticate(
configuration: configuration,
onCompletion: { result in
switch result {
case .success(let success):
print("Authentication success")
case .failure(let error):
break
}
})Authentication configuration
You can configure the authentication process with optional parameters in your BiomAuthConfig() instance or using the builder pattern methods from the AuthenticationConfiguration builder.
public data class BiomAuthConfig(
public val cameraDelaySeconds: Int = 0,
public val jwtSigningInfo: JwtSigningInfo?,
public val livenessConfiguration: LivenessSettings.LivenessConfiguration = PASSIVE_STANDALONE_HIGH,
public val livenessEnvironmentAware: Boolean = true
public val operationInfo: OperationInfo?,
public val shouldRemovePin: Boolean = false,
public val shouldRetrieveSecret: Boolean = false,
public val shouldDeleteSecret: Boolean = false,
public val showSuccessFeedback: Boolean = true,
public val generatingClientState: ClientStateType? = null
)public struct BiomAuthConfig: AuthConfig {
public let cameraDelaySeconds: Int
public let jwtSigningInfo: JwtSigningInfo?
public let livenessConfiguration: Keyless.LivenessConfiguration
public let livenessEnvironmentAware: Bool
public let operationInfo: Keyless.OperationInfo?
public let shouldRemovePin: Bool
public let shouldRetrieveSecret: Bool
public let shouldDeleteSecret: Bool
public let showSuccessFeedback: Bool
public let generatingClientState: ClientStateType?
}The successAnimationEnabled and later showScreenSuccessFlow field has been renamed to showSuccessFeedback, triggering a breaking change. Moreover the success animation is now shown by default.
Authentication success result
Depending on the builder methods you enable, Keyless will populate the corresponding fields in the AuthenticationSuccess result reported below.
Backup data
Backup data is no longer recommended to perform account recovery and the feature has been removed from Android and iOS SDKs. Use the client state instead. Follow the guide on account recovery.
Keyless can generate backup data that you can use to recover an account.
To create the backup data use the shouldRetrieveBackup configuration parameter. Once authentication succeeds, copy the backup data from the AuthenticationSuccess result, and store it securely.
To recover an account, use backup parameter during enrollment more in backup.
Delaying the Keyless evaluation/decision
By default, our biometric decision is set at a default two second delay between the camera preview appearing and the liveness evaluation beginning. We believe this offers an acceptable balance between usability and security i.e. delivering both approve and reject decisions in a way that feels natural and understandable to users.
However, we recognise that our customers, and their users, have different contexts and preferences and therefore the cameraDelaySeconds configuration is available to change the delay (in seconds) between when the camera preview appears, and when the liveness evaluation starts. In effect, no decision, whether \
Please note we advise careful consideration when implementing this feature for two reasons: i) While this allows users to frame themselves and have longer to understand what is happening, is also time for any attackers to also optimise their framing. ii) Implementing will ultimately mean that the "happy path" flow for all users is extended. If the delay is set for too long, some customers have noted that there is also the potential for some users to become frustrated and cancel/drop the flow. We're happy to engage further in what the best trade-offs may be for customers, given our wide-ranging experience of assisting customers in live implementations.
Custom Secret
If you saved a custom secret during enrollment, you can retrieve it using the shouldRetrieveSecret parameter.
Keyless will populate the field customSecret in the AuthenticationSuccess result.
Furthermore, such a custom secret can be deleted using the shouldDeleteSecret parameter.
JWT Signing info
You can specify a payload to be added to a JWT signed by Keyless with the jwtSigningInfo parameter, more in JWT signing.
Liveness Settings
Using livenessConfiguration you can configure the liveness security level during enrollment. The possible liveness configuration are under LivenessSettings.LivenessConfiguration :
You can also specify a livenessEnvironmentAware that is by default se to true to enhance liveness detection. This parameters helps to ensure the user is in a suitable setting for verification.
More details on liveness in the dedicated liveness settings section.
Operation info
The parameter operationInfo specifies a customizable unique operation identifier and associated payload stored on the Keyless backend if the authentication succeeds.
Details on how to query our backend for stored operations are available on Operations API.
Client State
Use the generatingClientState parameter of the BiomEnrollConfig or BiomAuthConfig to creata a client state useful for the account recovery.
Camera Preview Customization (BETA)
Use the presentationStyle parameter in BiomAuthConfig to control camera preview behavior during authentication.
.cameraPreview(default): Shows the standard live camera preview for user guidance..noCameraPreview: Hides the camera preview entirely, enabling a faster, minimal interface similar to native biometric flows on mobile devices.
ℹ️ UI Customization Note UI customization is not supported when using
.noCameraPreview
Last updated
Was this helpful?