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