|
@@ -66,10 +66,14 @@ public class KeychainManager {
|
|
kSecReturnData as String: true]
|
|
kSecReturnData as String: true]
|
|
var item: CFTypeRef?
|
|
var item: CFTypeRef?
|
|
let status = SecItemCopyMatching(query as CFDictionary, &item)
|
|
let status = SecItemCopyMatching(query as CFDictionary, &item)
|
|
- guard status != errSecItemNotFound else {
|
|
|
|
|
|
+ switch status {
|
|
|
|
+ case errSecSuccess:
|
|
|
|
+ break
|
|
|
|
+ case errSecItemNotFound:
|
|
throw KeychainError.noPassword
|
|
throw KeychainError.noPassword
|
|
- }
|
|
|
|
- guard status == errSecSuccess else {
|
|
|
|
|
|
+ case errSecInteractionNotAllowed:
|
|
|
|
+ throw KeychainError.unhandledError(message: "Keychain not yet available.", status: status)
|
|
|
|
+ default:
|
|
throw KeychainError.unhandledError(message: "Unknown error while querying secret for account \(id):",
|
|
throw KeychainError.unhandledError(message: "Unknown error while querying secret for account \(id):",
|
|
status: status)
|
|
status: status)
|
|
}
|
|
}
|