Restore that

This commit is contained in:
Max Goedjen 2021-01-17 17:36:50 -08:00
parent c5fe36cde1
commit 1e76513d0a
No known key found for this signature in database
GPG Key ID: E58C21DD77B9B8E8

View File

@ -121,27 +121,27 @@ extension SecureEnclave.Store {
} }
private func loadSecrets() { private func loadSecrets() {
// let attributes = [ let attributes = [
// kSecClass: kSecClassKey, kSecClass: kSecClassKey,
// kSecAttrKeyType: SecureEnclave.Constants.keyType, kSecAttrKeyType: SecureEnclave.Constants.keyType,
// kSecAttrApplicationTag: SecureEnclave.Constants.keyTag, kSecAttrApplicationTag: SecureEnclave.Constants.keyTag,
// kSecAttrKeyClass: kSecAttrKeyClassPublic, kSecAttrKeyClass: kSecAttrKeyClassPublic,
// kSecReturnRef: true, kSecReturnRef: true,
// kSecMatchLimit: kSecMatchLimitAll, kSecMatchLimit: kSecMatchLimitAll,
// kSecReturnAttributes: true kSecReturnAttributes: true
// ] as CFDictionary ] as CFDictionary
// var untyped: CFTypeRef? var untyped: CFTypeRef?
// SecItemCopyMatching(attributes, &untyped) SecItemCopyMatching(attributes, &untyped)
// guard let typed = untyped as? [[CFString: Any]] else { return } guard let typed = untyped as? [[CFString: Any]] else { return }
// let wrapped: [SecureEnclave.Secret] = typed.map { let wrapped: [SecureEnclave.Secret] = typed.map {
// let name = $0[kSecAttrLabel] as? String ?? "Unnamed" let name = $0[kSecAttrLabel] as? String ?? "Unnamed"
// let id = $0[kSecAttrApplicationLabel] as! Data let id = $0[kSecAttrApplicationLabel] as! Data
// let publicKeyRef = $0[kSecValueRef] as! SecKey let publicKeyRef = $0[kSecValueRef] as! SecKey
// let publicKeyAttributes = SecKeyCopyAttributes(publicKeyRef) as! [CFString: Any] let publicKeyAttributes = SecKeyCopyAttributes(publicKeyRef) as! [CFString: Any]
// let publicKey = publicKeyAttributes[kSecValueData] as! Data let publicKey = publicKeyAttributes[kSecValueData] as! Data
// return SecureEnclave.Secret(id: id, name: name, publicKey: publicKey) return SecureEnclave.Secret(id: id, name: name, publicKey: publicKey)
// } }
// secrets.append(contentsOf: wrapped) secrets.append(contentsOf: wrapped)
} }
private func savePublicKey(_ publicKey: SecKey, name: String) throws { private func savePublicKey(_ publicKey: SecKey, name: String) throws {