BiometricOnlyAuthenticator
public class BiometricOnlyAuthenticator : DefaultDeviceAuthenticator
An authenticator that uses biometrics (Face ID or Touch ID) for user authentication.
This class extends DefaultDeviceAuthenticator and provides specific implementations
for biometric-only key generation, authentication, and support checks.
-
Initializes the authenticator with a
BiometricAuthenticatorConfig.Declaration
Swift
public init(config: BiometricAuthenticatorConfig)Parameters
configThe configuration object for the authenticator.
-
The type of authenticator, specifically
.biometricOnly.Declaration
Swift
public override func type() -> DeviceBindingAuthenticationType -
register()AsynchronousGenerates a new cryptographic key pair for biometric authentication. The key is stored in the Secure Enclave (if available) and associated with a unique key tag.
Throws
CryptoKeyErrorif key generation fails.Declaration
Swift
public override func register() async throws -> KeyPairReturn Value
A
KeyPaircontaining the newly generated public and private keys. -
authenticate(keyTag:Asynchronous) Declaration
Swift
public override func authenticate(keyTag: String) async -> Result<SecKey, Error>Return Value
A
Resultcontaining theSecKeyon success, or anErroron failure. -
Checks if the device supports biometrics for authentication.
Note
Always returnsfalseon simulator — biometric keys require Secure Enclave to enforce the authentication challenge. Without it the key is accessible with no user verification, which is equivalent to the NONE type.Declaration
Swift
public override func isSupported(attestation: Attestation) -> BoolParameters
attestationThe attestation type (currently ignored).
Return Value
trueif the device supports biometric authentication,falseotherwise. -
deleteKeys()AsynchronousDeletes all biometric keys associated with this authenticator. It iterates through all stored user keys and deletes those with
.biometricOnlyor.biometricAllowFallbackauthentication types.Throws
CryptoKeyErrorif key deletion fails.Declaration
Swift
public override func deleteKeys() async throws
View on GitHub