Skip to content

Commit ec026d9

Browse files
committed
feat: added new error code indicating that ios private key is corrupted
1 parent 7a435cf commit ec026d9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ios/ReactNativeBiometrics.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import LocalAuthentication
33
import React
44
import Security
55
import CryptoKit
6+
import CryptoTokenKit
67

78
@objc(ReactNativeBiometrics)
89
class ReactNativeBiometrics: RCTEventEmitter {
@@ -826,6 +827,8 @@ class ReactNativeBiometrics: RCTEventEmitter {
826827
biometricsError = .userCancel
827828
} else if errorCode == errSecAuthFailed {
828829
biometricsError = .authenticationFailed
830+
} else if errorCode == TKError.Code.corruptedData.rawValue {
831+
biometricsError = .keyAccessFailed
829832
} else {
830833
biometricsError = .signatureCreationFailed
831834
}
@@ -1009,6 +1012,8 @@ class ReactNativeBiometrics: RCTEventEmitter {
10091012
biometricsError = ReactNativeBiometricsError.userCancel
10101013
} else if errorCode == errSecAuthFailed {
10111014
biometricsError = ReactNativeBiometricsError.authenticationFailed
1015+
} else if errorCode == TKError.Code.corruptedData.rawValue {
1016+
biometricsError = ReactNativeBiometricsError.keyAccessFailed
10121017
} else {
10131018
biometricsError = ReactNativeBiometricsError.signatureCreationFailed
10141019
}

0 commit comments

Comments
 (0)