Keychain: remove class constraint when copying

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2021-09-22 16:51:25 +02:00
parent adcbd17ebe
commit d882a486a9
+2 -4
View File
@@ -7,8 +7,7 @@ import Security
class Keychain { class Keychain {
static func openReference(called ref: Data) -> String? { static func openReference(called ref: Data) -> String? {
var result: CFTypeRef? var result: CFTypeRef?
let ret = SecItemCopyMatching([kSecClass: kSecClassGenericPassword, let ret = SecItemCopyMatching([kSecValuePersistentRef: ref,
kSecValuePersistentRef: ref,
kSecReturnData: true] as CFDictionary, kSecReturnData: true] as CFDictionary,
&result) &result)
if ret != errSecSuccess || result == nil { if ret != errSecSuccess || result == nil {
@@ -109,8 +108,7 @@ class Keychain {
} }
static func verifyReference(called ref: Data) -> Bool { static func verifyReference(called ref: Data) -> Bool {
return SecItemCopyMatching([kSecClass: kSecClassGenericPassword, return SecItemCopyMatching([kSecValuePersistentRef: ref] as CFDictionary,
kSecValuePersistentRef: ref] as CFDictionary,
nil) != errSecItemNotFound nil) != errSecItemNotFound
} }
} }