authenticate
open suspend override fun authenticate(context: Context): Result<Pair<PrivateKey, BiometricPrompt.CryptoObject?>>
Authenticates the device by retrieving the stored private key.
This method attempts to authenticate in the following order:
If a cached key pair exists (from recent registration), uses it directly
Otherwise, prompts for PIN and retrieves private key from storage
Implements retry mechanism with configurable attempts
Clears cached key pair after use for security
The method handles various error conditions including:
User cancellation during PIN entry
Invalid PIN attempts with retry logic
Missing or corrupted keystore data
File system errors
Return
Result containing Pair of PrivateKey and null BiometricPrompt.CryptoObject on success, or failure with appropriate exception
Parameters
context
Android context for any UI operations (not used in PIN auth)