1 import ABI49_0_0ExpoModulesCore
2 
3 internal class InvalidKeyException: Exception {
4   override var reason: String {
5     "Invalid key"
6   }
7 }
8 
9 internal class MissingPlistKeyException: Exception {
10   override var reason: String {
11     "You must set `NSFaceIDUsageDescription` in your Info.plist file to use the `requireAuthentication` option"
12   }
13 }
14 
15 internal class KeyChainException: GenericException<OSStatus> {
16   override var reason: String {
17     switch param {
18     case errSecUnimplemented:
19       return "Function or operation not implemented."
20 
21     case errSecIO:
22       return "I/O error."
23 
24     case errSecOpWr:
25       return "File already open with with write permission."
26 
27     case errSecParam:
28       return "One or more parameters passed to a function where not valid."
29 
30     case errSecAllocate:
31       return "Failed to allocate memory."
32 
33     case errSecUserCanceled:
34       return "User canceled the operation."
35 
36     case errSecBadReq:
37       return "Bad parameter or invalid state for operation."
38 
39     case errSecNotAvailable:
40       return "No keychain is available. You may need to restart your computer."
41 
42     case errSecDuplicateItem:
43       return "The specified item already exists in the keychain."
44 
45     case errSecItemNotFound:
46       return "The specified item could not be found in the keychain."
47 
48     case errSecInteractionNotAllowed:
49       return "User interaction is not allowed."
50 
51     case errSecDecode:
52       return "Unable to decode the provided data."
53 
54     case errSecAuthFailed:
55       return "Authentication failed. Provided passphrase/PIN is incorrect or there is no user authentication method configured for this device."
56 
57     default:
58       return "Unknown Keychain Error."
59     }
60   }
61 }
62