diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1706aa9..56bfbe1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} run: ./.github/scripts/signing.sh - name: Set Environment - run: sudo xcrun xcode-select -s /Applications/Xcode_13.1.app + run: sudo xcrun xcode-select -s /Applications/Xcode_13.2.app - name: Test run: xcrun xcodebuild test -project Secretive.xcodeproj -scheme Secretive build: @@ -38,7 +38,7 @@ jobs: APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} run: ./.github/scripts/signing.sh - name: Set Environment - run: sudo xcrun xcode-select -s /Applications/Xcode_13.1.app + run: sudo xcrun xcode-select -s /Applications/Xcode_13.2.app - name: Update Build Number env: TAG_NAME: ${{ github.ref }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 95579d8..430be2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set Environment - run: sudo xcrun xcode-select -s /Applications/Xcode_13.1.app + run: sudo xcrun xcode-select -s /Applications/Xcode_13.2.app - name: Test run: xcrun xcodebuild test -project Secretive.xcodeproj -scheme Secretive diff --git a/SecretKit/SecureEnclave/SecureEnclaveStore.swift b/SecretKit/SecureEnclave/SecureEnclaveStore.swift index 2a18a83..8e68c9f 100644 --- a/SecretKit/SecureEnclave/SecureEnclaveStore.swift +++ b/SecretKit/SecureEnclave/SecureEnclaveStore.swift @@ -56,13 +56,15 @@ extension SecureEnclave { ] ] as CFDictionary - var privateKey: SecKey? = nil - var publicKey: SecKey? = nil - let status = SecKeyGeneratePair(attributes, &publicKey, &privateKey) - guard privateKey != nil, let pk = publicKey else { - throw KeychainError(statusCode: status) + var createKeyError: SecurityError? + let keypair = SecKeyCreateRandomKey(attributes, &createKeyError) + if let error = createKeyError { + throw error.takeRetainedValue() as Error } - try savePublicKey(pk, name: name) + guard let keypair = keypair, let publicKey = SecKeyCopyPublicKey(keypair) else { + throw KeychainError(statusCode: nil) + } + try savePublicKey(publicKey, name: name) reloadSecrets() } @@ -218,7 +220,7 @@ extension SecureEnclave.Store { extension SecureEnclave { public struct KeychainError: Error { - public let statusCode: OSStatus + public let statusCode: OSStatus? } public struct SigningError: Error { diff --git a/Secretive.xcodeproj/project.pbxproj b/Secretive.xcodeproj/project.pbxproj index 630f5c5..e2b5406 100644 --- a/Secretive.xcodeproj/project.pbxproj +++ b/Secretive.xcodeproj/project.pbxproj @@ -870,7 +870,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1220; - LastUpgradeCheck = 1130; + LastUpgradeCheck = 1320; ORGANIZATIONNAME = "Max Goedjen"; TargetAttributes = { 50617D7E23FCE48D0099B055 = { @@ -1221,6 +1221,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -1282,6 +1283,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -1617,6 +1619,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; diff --git a/Secretive.xcodeproj/xcshareddata/xcschemes/SecretAgent.xcscheme b/Secretive.xcodeproj/xcshareddata/xcschemes/SecretAgent.xcscheme index e425e9c..647184f 100644 --- a/Secretive.xcodeproj/xcshareddata/xcschemes/SecretAgent.xcscheme +++ b/Secretive.xcodeproj/xcshareddata/xcschemes/SecretAgent.xcscheme @@ -1,6 +1,6 @@