Fix a few analyzer/Xcode 13.4b1 warnings (#449)

* Fix missing combine imports

* Fix a few other new warnings
This commit is contained in:
Max Goedjen
2023-02-18 17:37:38 -08:00
committed by GitHub
parent 3bd8e3b494
commit f54b2a33bf
5 changed files with 34 additions and 27 deletions

View File

@ -1,4 +1,5 @@
import Foundation
import Combine
import Security
import CryptoTokenKit
import LocalAuthentication
@ -49,14 +50,14 @@ extension SmartCard {
let context = LAContext()
context.localizedReason = "sign a request from \"\(provenance.origin.displayName)\" using secret \"\(secret.name)\""
context.localizedCancelTitle = "Deny"
let attributes = [
let attributes = KeychainDictionary([
kSecClass: kSecClassKey,
kSecAttrKeyClass: kSecAttrKeyClassPrivate,
kSecAttrApplicationLabel: secret.id as CFData,
kSecAttrTokenID: tokenID,
kSecUseAuthenticationContext: context,
kSecReturnRef: true
] as CFDictionary
])
var untyped: CFTypeRef?
let status = SecItemCopyMatching(attributes, &untyped)
if status != errSecSuccess {
@ -136,14 +137,14 @@ extension SmartCard.Store {
}
}
let attributes = [
let attributes = KeychainDictionary([
kSecClass: kSecClassKey,
kSecAttrTokenID: tokenID,
kSecAttrKeyType: kSecAttrKeyTypeEC, // Restrict to EC
kSecReturnRef: true,
kSecMatchLimit: kSecMatchLimitAll,
kSecReturnAttributes: true
] as CFDictionary
])
var untyped: CFTypeRef?
SecItemCopyMatching(attributes, &untyped)
guard let typed = untyped as? [[CFString: Any]] else { return }