From f72c509854d042c11f065f6973e1166ceab8ab3f Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Tue, 13 Feb 2024 21:15:20 -0800 Subject: [PATCH] Remove CF bridges --- .../SecureEnclaveStore.swift | 12 ++++++------ .../SmartCardSecretKit/SmartCardStore.swift | 4 ++-- Sources/Secretive.xcodeproj/project.pbxproj | 15 ++++++--------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift b/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift index d079bf3..d9093c3 100644 --- a/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift +++ b/Sources/Packages/Sources/SecureEnclaveSecretKit/SecureEnclaveStore.swift @@ -75,7 +75,7 @@ extension SecureEnclave { public func delete(secret: Secret) throws { let deleteAttributes = KeychainDictionary([ kSecClass: kSecClassKey, - kSecAttrApplicationLabel: secret.id as CFData + kSecAttrApplicationLabel: secret.id ]) let status = SecItemDelete(deleteAttributes) if status != errSecSuccess { @@ -87,7 +87,7 @@ extension SecureEnclave { public func update(secret: Secret, name: String) throws { let updateQuery = KeychainDictionary([ kSecClass: kSecClassKey, - kSecAttrApplicationLabel: secret.id as CFData + kSecAttrApplicationLabel: secret.id ]) let updatedAttributes = KeychainDictionary([ @@ -114,7 +114,7 @@ extension SecureEnclave { let attributes = KeychainDictionary([ kSecClass: kSecClassKey, kSecAttrKeyClass: kSecAttrKeyClassPrivate, - kSecAttrApplicationLabel: secret.id as CFData, + kSecAttrApplicationLabel: secret.id, kSecAttrKeyType: Constants.keyType, kSecAttrTokenID: kSecAttrTokenIDSecureEnclave, kSecAttrApplicationTag: Constants.keyTag, @@ -145,7 +145,7 @@ extension SecureEnclave { let attributes = KeychainDictionary([ kSecClass: kSecClassKey, kSecAttrKeyClass: kSecAttrKeyClassPrivate, - kSecAttrApplicationLabel: secret.id as CFData, + kSecAttrApplicationLabel: secret.id, kSecAttrKeyType: Constants.keyType, kSecAttrTokenID: kSecAttrTokenIDSecureEnclave, kSecAttrApplicationTag: Constants.keyTag, @@ -304,8 +304,8 @@ extension SecureEnclave.Store { extension SecureEnclave { enum Constants { - static let keyTag = "com.maxgoedjen.secretive.secureenclave.key".data(using: .utf8)! as CFData - static let keyType = kSecAttrKeyTypeECSECPrimeRandom + static let keyTag = Data("com.maxgoedjen.secretive.secureenclave.key".utf8) + static let keyType = kSecAttrKeyTypeECSECPrimeRandom as String static let unauthenticatedThreshold: TimeInterval = 0.05 } diff --git a/Sources/Packages/Sources/SmartCardSecretKit/SmartCardStore.swift b/Sources/Packages/Sources/SmartCardSecretKit/SmartCardStore.swift index f6f83c8..8732d22 100644 --- a/Sources/Packages/Sources/SmartCardSecretKit/SmartCardStore.swift +++ b/Sources/Packages/Sources/SmartCardSecretKit/SmartCardStore.swift @@ -55,7 +55,7 @@ extension SmartCard { let attributes = KeychainDictionary([ kSecClass: kSecClassKey, kSecAttrKeyClass: kSecAttrKeyClassPrivate, - kSecAttrApplicationLabel: secret.id as CFData, + kSecAttrApplicationLabel: secret.id, kSecAttrTokenID: tokenID, kSecUseAuthenticationContext: context, kSecReturnRef: true @@ -217,7 +217,7 @@ extension SmartCard.Store { let attributes = KeychainDictionary([ kSecClass: kSecClassKey, kSecAttrKeyClass: kSecAttrKeyClassPrivate, - kSecAttrApplicationLabel: secret.id as CFData, + kSecAttrApplicationLabel: secret.id, kSecAttrTokenID: tokenID, kSecUseAuthenticationContext: context, kSecReturnRef: true diff --git a/Sources/Secretive.xcodeproj/project.pbxproj b/Sources/Secretive.xcodeproj/project.pbxproj index 6a67328..d1d9da5 100644 --- a/Sources/Secretive.xcodeproj/project.pbxproj +++ b/Sources/Secretive.xcodeproj/project.pbxproj @@ -612,13 +612,14 @@ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_SWIFT_FLAGS = "-Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks"; + OTHER_SWIFT_FLAGS = ""; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; STRIP_SWIFT_SYMBOLS = NO; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_STRICT_CONCURRENCY = complete; }; name = Debug; }; @@ -671,13 +672,14 @@ MACOSX_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; - OTHER_SWIFT_FLAGS = "-Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks"; + OTHER_SWIFT_FLAGS = ""; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; STRIP_SWIFT_SYMBOLS = NO; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_STRICT_CONCURRENCY = complete; }; name = Release; }; @@ -705,7 +707,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.maxgoedjen.Secretive.Host; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; }; name = Debug; @@ -734,7 +735,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.maxgoedjen.Secretive.Host; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "Secretive - Host"; - SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; }; name = Release; @@ -837,13 +837,14 @@ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_SWIFT_FLAGS = "-Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks"; + OTHER_SWIFT_FLAGS = ""; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; STRIP_SWIFT_SYMBOLS = NO; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_STRICT_CONCURRENCY = complete; }; name = Test; }; @@ -867,7 +868,6 @@ MARKETING_VERSION = 1; PRODUCT_BUNDLE_IDENTIFIER = com.maxgoedjen.Secretive.Host; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; }; name = Test; @@ -912,7 +912,6 @@ MARKETING_VERSION = 1; PRODUCT_BUNDLE_IDENTIFIER = com.maxgoedjen.Secretive.SecretAgent; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; }; name = Test; @@ -937,7 +936,6 @@ MARKETING_VERSION = 1; PRODUCT_BUNDLE_IDENTIFIER = com.maxgoedjen.Secretive.SecretAgent; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; }; name = Debug; @@ -964,7 +962,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.maxgoedjen.Secretive.SecretAgent; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "Secretive - Secret Agent"; - SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; }; name = Release;