File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
BitwardenShared/Core/Auth/Services/Biometrics Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,8 @@ class DefaultBiometricsRepository: BiometricsRepository {
152
152
switch status {
153
153
case kLAErrorBiometryLockout:
154
154
throw BiometricsServiceError . biometryLocked
155
- case errSecUserCanceled,
155
+ case errSecAuthFailed,
156
+ errSecUserCanceled,
156
157
kLAErrorAppCancel,
157
158
kLAErrorSystemCancel,
158
159
kLAErrorUserCancel:
Original file line number Diff line number Diff line change @@ -111,6 +111,18 @@ final class BiometricsRepositoryTests: BitwardenTestCase { // swiftlint:disable:
111
111
XCTAssertEqual ( key, expectedKey)
112
112
}
113
113
114
+ /// `setBiometricUnlockKey` throws a cancelled error for `errSecAuthFailed` if the device is
115
+ /// locked while performing biometrics.
116
+ func test_getBiometricUnlockKey_authFailed( ) async throws {
117
+ stateService. activeAccount = . fixture( )
118
+ keychainService. getResult = . failure(
119
+ KeychainServiceError . osStatusError ( errSecAuthFailed)
120
+ )
121
+ await assertAsyncThrows ( error: BiometricsServiceError . biometryCancelled) {
122
+ _ = try await subject. getUserAuthKey ( )
123
+ }
124
+ }
125
+
114
126
/// `getBiometricUnlockStatus` throws an error if the user has locked biometrics.
115
127
func test_getBiometricUnlockStatus_lockout( ) async throws {
116
128
let active = Account . fixture ( )
You can’t perform that action at this time.
0 commit comments