From 3ca11df38f9e3a216e0d6ad0c1f943d88f48d754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20=C4=8Eurech?= Date: Thu, 3 Nov 2022 09:52:33 +0100 Subject: [PATCH] Apple: #495: Test for already locked out biometry --- proj-xcode/PowerAuth2/PowerAuthSDK.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proj-xcode/PowerAuth2/PowerAuthSDK.m b/proj-xcode/PowerAuth2/PowerAuthSDK.m index c38afe09..d7efbc36 100644 --- a/proj-xcode/PowerAuth2/PowerAuthSDK.m +++ b/proj-xcode/PowerAuth2/PowerAuthSDK.m @@ -1266,6 +1266,13 @@ - (void) authenticateUsingBiometryImpl:(PowerAuthKeychainAuthentication *)keycha return; } + // Check biometric status in advance, do do not increase failed attempts counter + // in case that biometry is already locked out. + if (![PowerAuthKeychain canUseBiometricAuthentication]) { + callback(nil, PA2MakeError(PowerAuthErrorCode_BiometryNotAvailable, nil)); + return; + } + // Use app provided, or create a new LAContext if "prompt" variant is used. NSString * prompt = keychainAuthentication.prompt; LAContext * context = keychainAuthentication.context;