The XignSys SDK offers a way to determine whether a specific authentication factor has been set up. This can for example be helpful to decide whether the user should be offered a settings entry to add a biometric factor which enrollment has been skipped during the personalization process.
internal func hasAuthenticationFactor(
idmIdentifier: String
) throws {
// Retrieve the personalizer component that offers this utility function
let personalizer: Personalizer = XignSdk.shared.personalizer
// Check whether a biometric factor is set up as an example
let isBiometricFactorEnrolled: Bool
do {
isBiometricFactorEnrolled = try personalizer
.hasAuthenticationFactor(idmIdentifier: idmIdentifier, type: .biometric)
} catch {
// TODO: Handle errors
YourImplementation.handleTheError()
return
}
if !isBiometricFactorEnrolled {
YourImplementation.showOptionToSetUpBiometrics(idmIdentifier)
}
}
internal fun hasAuthenticationFactor(
idmIdentifier: String
) {
// Retrieve the personalizer component that offers this utility function
val personalizer: Personalizer = XignSdk.shared.personalizer
// Check whether a biometric factor is set up as an example
val isBiometricFactorEnrolled: Boolean
try {
isBiometricFactorEnrolled = personalizer.hasAuthenticationFactor(
idmIdentifier = idmIdentifier,
type = AuthenticatorType.BIOMETRIC
)
} catch (t: Throwable) {
// TODO: Handle errors
YourImplementation.handleTheException()
return
}
if (!isBiometricFactorEnrolled) {
YourImplementation.showOptionToSetUpBiometrics(idmIdentifier)
}
}
Note: This only checks if the necessary certificates are present and the server is aware that the factor has been set up. Depending on the factor, this is not a guarantee that the factor still can be used. In case of the biometric factor, if the user has changed the system biometric configuration, the corresponding key could have been marked as invalid. Only trying to use the key will clarify its state.