register

open suspend override fun register(context: Context, attestation: Attestation): Result<KeyPair>

Registers a new device by generating biometric-only protected RSA key pairs.

This method creates a new RSA key pair in the Android Keystore with exclusive biometric protection, ensuring that keys can only be accessed through biometric authentication without any fallback mechanisms. The key generation process adapts to device capabilities while maintaining strict biometric-only access requirements.

Return

Result containing KeyPair with public key, private key reference, and key alias on success, or failure with appropriate exception

Parameters

context

Android context for accessing system services and checking device capabilities

attestation

Attestation configuration specifying hardware verification requirements. Attestation.Default enables hardware attestation with challenge verification. Attestation.None generates keys without attestation.

See also

CryptoKey.create
KeyGenParameterSpec

Throws

if key generation fails due to hardware limitations, biometric unavailability, invalid parameters, or system security policy violations