diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 409d384..51279f1 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -# Copyright 2023, Jamf +# Copyright 2024, Jamf name: UnitTests @@ -11,18 +11,18 @@ on: jobs: Test-on-macOS: - runs-on: macos-latest + runs-on: macos-14 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run macOS tests (including integration) run: swift test Test-on-all-others: - runs-on: macos-latest + runs-on: macos-14 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run iOS tests run: xcodebuild test -scheme Haversack-Package -destination 'platform=iOS Simulator,name=iPhone 14' - name: Run tvOS tests @@ -34,6 +34,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: GitHub Action for SwiftLint uses: norio-nomura/action-swiftlint@3.2.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 987743e..55dce3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.0] - 2024-02-11 +### Added +- Added support for visionOS. + ## [1.1.1] - 2024-01-05 ### Changed - System keychain is located using Security framework API. diff --git a/LICENSE b/LICENSE index fb2aef2..0826045 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright 2023, Jamf +Copyright 2024, Jamf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Package.resolved b/Package.resolved index 8816dca..ad0205c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections", "state" : { - "revision" : "d029d9d39c87bed85b1c50adee7c41795261a192", - "version" : "1.0.6" + "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", + "version" : "1.1.0" } }, { diff --git a/Package.swift b/Package.swift index c17956b..2f0c125 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.6 +// swift-tools-version:5.9 // SPDX-License-Identifier: MIT // Copyright 2023, Jamf @@ -10,6 +10,7 @@ let package = Package( .macOS(.v10_13), .iOS(.v12), .tvOS(.v12), + .visionOS(.v1), .watchOS(.v5) ], products: [ @@ -18,15 +19,19 @@ let package = Package( .library(name: "HaversackMock", targets: ["HaversackMock"]) ], dependencies: [ - .package(url: "https://github.com/apple/swift-collections", from: "1.0.4"), - .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.2.0") + .package(url: "https://github.com/apple/swift-collections", from: "1.1.0"), + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0") ], targets: [ - .target(name: "Haversack", dependencies: [ - .product(name: "OrderedCollections", package: "swift-collections")]), + .target(name: "Haversack", + dependencies: [ + .product(name: "OrderedCollections", package: "swift-collections") + ], + resources: [.process("Resources/")]), .target(name: "HaversackCryptoKit", dependencies: ["Haversack"]), .target(name: "HaversackMock", dependencies: ["Haversack"]), - .testTarget(name: "HaversackTests", dependencies: ["HaversackMock"], + .testTarget(name: "HaversackTests", + dependencies: ["HaversackMock"], resources: [.copy("TestResources/")]) ] ) diff --git a/README.md b/README.md index 37528de..732209a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Haversack: Swift library for keychain access -A Swift library for interacting with the Keychain on all Apple devices. Supports macOS, iOS/iPadOS, tvOS, and watchOS. +A Swift library for interacting with the Keychain on all Apple devices. Supports macOS, iOS/iPadOS, tvOS, visionOS, and watchOS. ## Goal @@ -130,12 +130,13 @@ Before submitting your pull request, please do the following: - If you are adding new commands or features, they should include unit tests. If you are changing functionality, update the tests or add new tests as needed. - Verify all unit tests pass on all four supported operating systems. There are two ways to do this: - 1. In Xcode you can switch destinations to each of the following: "My Mac", any iOS Simulator, any tvOS Simulator, and any watchOS Simulator. Run the unit tests for each of the destinations. - 2. Four command line invocations: + 1. In Xcode you can switch destinations to each of the following: "My Mac", any iOS Simulator, any tvOS Simulator, any visionOS Simulator, and any watchOS Simulator. Run the unit tests for each of the destinations. + 2. Five command line invocations: - `swift test` to verify macOS functionality. - `xcodebuild test -scheme Haversack-Package -destination 'platform=iOS Simulator,name=iPhone 14'` to verify iOS functionality. - `xcodebuild test -scheme Haversack-Package -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'` to verify tvOS functionality. - - `xcodebuild test -scheme Haversack-Package -destination 'platform=watchOS Simulator,name=Apple Watch Series 8 (41mm)` to verify watchOS functionality. + - `xcodebuild test -scheme Haversack-Package -destination 'platform=watchOS Simulator,name=Apple Watch Series 9 (41mm)'` to verify watchOS functionality. + - `xcodebuild test -scheme Haversack-Package -destination 'platform=visionOS Simulator,name=Apple Vision Pro'` to verify visionOS functionality. - Run [SwiftLint](https://github.com/realm/SwiftLint) on the code. Fix any warnings or errors that appear. - Add a note to the CHANGELOG describing what you changed. - If your pull request is related to an issue, add a link to the issue in the description. diff --git a/Sources/Haversack/Documentation.docc/Haversack.md b/Sources/Haversack/Documentation.docc/Haversack.md index 14fcf5e..87d5a2a 100644 --- a/Sources/Haversack/Documentation.docc/Haversack.md +++ b/Sources/Haversack/Documentation.docc/Haversack.md @@ -1,6 +1,6 @@ # ``Haversack`` -A type-safe fluent interface for the keychain on macOS, iOS/iPadOS, tvOS, and watchOS. +A type-safe fluent interface for the keychain on macOS, iOS/iPadOS, tvOS, visionOS, and watchOS. ## Overview diff --git a/Sources/Haversack/Haversack+AsyncAwait.swift b/Sources/Haversack/Haversack+AsyncAwait.swift index e675478..e59059a 100644 --- a/Sources/Haversack/Haversack+AsyncAwait.swift +++ b/Sources/Haversack/Haversack+AsyncAwait.swift @@ -3,7 +3,7 @@ import Foundation -@available(macOS 10.15.0, iOS 13.0.0, tvOS 13.0.0, watchOS 6.0, *) +@available(macOS 10.15.0, iOS 13.0.0, tvOS 13.0.0, watchOS 6.0, visionOS 1.0, *) extension Haversack { /// This is equivalent to calling ``first(where:completionQueue:completion:)`` but using async-await syntax. public func first(where query: T) async throws -> T.Entity { diff --git a/Sources/Haversack/Haversack.swift b/Sources/Haversack/Haversack.swift index ffbe602..c2d5063 100644 --- a/Sources/Haversack/Haversack.swift +++ b/Sources/Haversack/Haversack.swift @@ -371,8 +371,8 @@ public struct Haversack { /// Synchronously delete an item from the keychain that was previously retrieved from the keychain. /// - /// If the item does not include a `reference` previously retrieved from the keychain: on iOS/tvOS/watchOS all items - /// matching the item metadata will be deleted, while on macOS only the first matching item will be deleted. + /// If the item does not include a `reference` previously retrieved from the keychain: on iOS/tvOS/visionOS/watchOS + /// all items matching the item metadata will be deleted, while on macOS only the first matching item will be deleted. /// - Parameter item: The item retrieved from the keychain. /// - Parameter treatNotFoundAsSuccess: If true, no error is thrown when the query does not /// find an item to delete; default is true. @@ -385,8 +385,8 @@ public struct Haversack { /// Aynchronously delete an item from the keychain that was previously retrieved from the keychain. /// - /// If the item does not include a `reference` previously retrieved from the keychain: on iOS/tvOS/watchOS all items - /// matching the item metadata will be deleted, while on macOS only the first matching item will be deleted. + /// If the item does not include a `reference` previously retrieved from the keychain: on iOS/tvOS/visionOS/watchOS + /// all items matching the item metadata will be deleted, while on macOS only the first matching item will be deleted. /// - Parameters: /// - item: The item retrieved from the keychain. /// - treatNotFoundAsSuccess: If true, no error is thrown when the query does not find an diff --git a/PrivacyInfo.xcprivacy b/Sources/Haversack/Resources/PrivacyInfo.xcprivacy similarity index 100% rename from PrivacyInfo.xcprivacy rename to Sources/Haversack/Resources/PrivacyInfo.xcprivacy diff --git a/Sources/HaversackCryptoKit/GenericPasswordConvertible+CryptoKit.swift b/Sources/HaversackCryptoKit/GenericPasswordConvertible+CryptoKit.swift index 54a6f45..5e41fac 100644 --- a/Sources/HaversackCryptoKit/GenericPasswordConvertible+CryptoKit.swift +++ b/Sources/HaversackCryptoKit/GenericPasswordConvertible+CryptoKit.swift @@ -5,21 +5,21 @@ import CryptoKit import Foundation import Haversack -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension Curve25519.KeyAgreement.PrivateKey: GenericPasswordConvertible { public static func make(fromRaw data: Data) throws -> Self { return try Self.init(rawRepresentation: data) } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension Curve25519.Signing.PrivateKey: GenericPasswordConvertible { public static func make(fromRaw data: Data) throws -> Self { return try Self.init(rawRepresentation: data) } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension SymmetricKey: GenericPasswordConvertible { public static func make(fromRaw data: Data) throws -> Self { return Self.init(data: data) @@ -32,7 +32,7 @@ extension SymmetricKey: GenericPasswordConvertible { } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension SecureEnclave.P256.KeyAgreement.PrivateKey: GenericPasswordConvertible { public static func make(fromRaw data: Data) throws -> Self { return try Self.init(dataRepresentation: data) @@ -43,7 +43,7 @@ extension SecureEnclave.P256.KeyAgreement.PrivateKey: GenericPasswordConvertible } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension SecureEnclave.P256.Signing.PrivateKey: GenericPasswordConvertible { public static func make(fromRaw data: Data) throws -> Self { return try Self.init(dataRepresentation: data) diff --git a/Sources/HaversackCryptoKit/SecKeyConvertible.swift b/Sources/HaversackCryptoKit/SecKeyConvertible.swift index a1032b3..023c429 100644 --- a/Sources/HaversackCryptoKit/SecKeyConvertible.swift +++ b/Sources/HaversackCryptoKit/SecKeyConvertible.swift @@ -17,17 +17,17 @@ public protocol SecKeyConvertible { var x963Representation: Data { get } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension P256.Signing.PrivateKey: SecKeyConvertible {} -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension P256.KeyAgreement.PrivateKey: SecKeyConvertible {} -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension P384.Signing.PrivateKey: SecKeyConvertible {} -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension P384.KeyAgreement.PrivateKey: SecKeyConvertible {} -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension P521.Signing.PrivateKey: SecKeyConvertible {} -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, visionOS 1.0, *) extension P521.KeyAgreement.PrivateKey: SecKeyConvertible {} // MARK: - storage diff --git a/Tests/HaversackTests/HaversackAsyncAwaitTests.swift b/Tests/HaversackTests/HaversackAsyncAwaitTests.swift index 334d20f..ab5c2f1 100644 --- a/Tests/HaversackTests/HaversackAsyncAwaitTests.swift +++ b/Tests/HaversackTests/HaversackAsyncAwaitTests.swift @@ -1,16 +1,12 @@ -// -// HaversackAsyncAwaitTests.swift -// -// -// Created by Jacob Hearst on 9/30/22. -// +// SPDX-License-Identifier: MIT +// Copyright 2023, Jamf import Foundation import Haversack import HaversackMock import XCTest -@available(macOS 10.15.0, iOS 13.0.0, tvOS 13.0.0, watchOS 6.0, *) +@available(macOS 10.15.0, iOS 13.0.0, tvOS 13.0.0, watchOS 6.0, visionOS 1.0, *) final class HaversackAsyncAwaitTests: XCTestCase { var haversack: Haversack! var strategy: HaversackEphemeralStrategy!