diff --git a/.devcontainer/aarch64/devcontainer-lock.json b/.devcontainer/aarch64/devcontainer-lock.json new file mode 100644 index 0000000..f6c7208 --- /dev/null +++ b/.devcontainer/aarch64/devcontainer-lock.json @@ -0,0 +1,14 @@ +{ + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "version": "2.5.9", + "resolved": "ghcr.io/devcontainers/features/common-utils@sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a", + "integrity": "sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "1.3.8", + "resolved": "ghcr.io/devcontainers/features/git@sha256:fd75977de13a9979000e0e78baf949adb0ca71d2398995fa22e0a36d7e7e7fe2", + "integrity": "sha256:fd75977de13a9979000e0e78baf949adb0ca71d2398995fa22e0a36d7e7e7fe2" + } + } +} diff --git a/.devcontainer/aarch64/devcontainer.json b/.devcontainer/aarch64/devcontainer.json index 53a6595..b9a3c04 100644 --- a/.devcontainer/aarch64/devcontainer.json +++ b/.devcontainer/aarch64/devcontainer.json @@ -1,6 +1,6 @@ { "name": "Swift", - "image": "swift:6.0", + "image": "swift:6.1", "features": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "false", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb5b6e4..6ca965f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: test-linux: name: "Test Linux" runs-on: ubuntu-latest - container: swift:6.0-jammy + container: swift:6.1-noble steps: - name: Checkout uses: actions/checkout@v4 diff --git a/Package.resolved b/Package.resolved index b4c6f76..8e02992 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "80abcad025789e7c46ac8ef30ab5480c5c71e5f67deab23941ea02aa0d3e4c09", + "originHash" : "ec37b77adff7adafffd884de38574520cb462bcbeb6311eb58779537fcfd6cdd", "pins" : [ { "identity" : "swift-asn1", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-asn1.git", "state" : { - "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc", - "version" : "1.4.0" + "revision" : "a9a5efd40eaf558a2bcd48d64b1d1646be686008", + "version" : "1.7.1" } }, { @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-certificates.git", "state" : { - "revision" : "4b092f15164144c24554e0a75e080a960c5190a6", - "version" : "1.14.0" + "revision" : "449dbbecd0f31e82b510ada227ca152caa8b5e98", + "version" : "1.19.4" } }, { @@ -24,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "d1c6b70f7c5f19fb0b8750cb8dcdf2ea6e2d8c34", - "version" : "3.15.0" + "revision" : "47d3869a7291f085c1fb9fb1e6d3b97a793f45c6", + "version" : "4.5.1" } }, { @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-system.git", "state" : { - "revision" : "395a77f0aa927f0ff73941d7ac35f2b46d47c9db", - "version" : "1.6.3" + "revision" : "869129b7bf4ecc57b97d0193ad29690ca2134750", + "version" : "1.8.1" } }, { @@ -42,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/adam-fowler/swift-zip-archive.git", "state" : { - "revision" : "2cf559f47443d99924950c4114aba1af3e688c7d", - "version" : "0.6.3" + "revision" : "0958a719c924d2b3cb27cd7d9f76b4cfb04549f2", + "version" : "0.8.1" } } ], diff --git a/Package.swift b/Package.swift index 82452f1..6d4b38e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,8 +1,19 @@ -// swift-tools-version: 6.0 +// swift-tools-version: 6.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription +let swiftSettings: [SwiftSetting] = [ + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0335-existential-any.md + .enableUpcomingFeature("ExistentialAny"), + + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md + .enableUpcomingFeature("InternalImportsByDefault"), + + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + .enableUpcomingFeature("MemberImportVisibility"), +] + let package = Package( name: "PassKit", platforms: [ @@ -15,12 +26,13 @@ let package = Package( .library(name: "PassHelpers", targets: ["PassHelpers"]), ], dependencies: [ - .package(url: "https://github.com/adam-fowler/swift-zip-archive.git", .upToNextMajor(from: "0.6.3")), - .package(url: "https://github.com/apple/swift-certificates.git", from: "1.14.0") + .package(url: "https://github.com/adam-fowler/swift-zip-archive.git", .upToNextMajor(from: "0.8.1")), + .package(url: "https://github.com/apple/swift-certificates.git", from: "1.19.0") ], targets: [ .target( - name: "PassCore" + name: "PassCore", + swiftSettings: swiftSettings ), .target( name: "PassGen", @@ -31,14 +43,16 @@ let package = Package( ], resources: [ .process("Resources") - ] + ], + swiftSettings: swiftSettings ), .target( name: "PassHelpers", dependencies: [ .target(name: "PassCore"), .target(name: "PassGen") - ] + ], + swiftSettings: swiftSettings ), .testTarget( name: "PassKitTests", @@ -47,7 +61,8 @@ let package = Package( .target(name: "PassGen"), .product(name: "X509", package: "swift-certificates") ], - resources: [.process("Resources")] + resources: [.process("Resources")], + swiftSettings: swiftSettings ), ] ) diff --git a/Sources/PassCore/Extensions.swift b/Sources/PassCore/Extensions.swift index b621645..5448455 100644 --- a/Sources/PassCore/Extensions.swift +++ b/Sources/PassCore/Extensions.swift @@ -2,9 +2,9 @@ // Copyright (c) 2025 hiimtmac inc. #if canImport(FoundationEssentials) -import FoundationEssentials +public import FoundationEssentials #else -import Foundation +public import Foundation #endif extension JSONEncoder { diff --git a/Sources/PassCore/Pass.swift b/Sources/PassCore/Pass.swift index 8d1db17..05c190a 100755 --- a/Sources/PassCore/Pass.swift +++ b/Sources/PassCore/Pass.swift @@ -2,9 +2,9 @@ // Copyright (c) 2025 hiimtmac inc. #if canImport(FoundationEssentials) -import FoundationEssentials +public import FoundationEssentials #else -import Foundation +public import Foundation #endif // https://developer.apple.com/documentation/walletpasses/pass diff --git a/Sources/PassCore/PassFieldContent.swift b/Sources/PassCore/PassFieldContent.swift index fafe621..579489f 100755 --- a/Sources/PassCore/PassFieldContent.swift +++ b/Sources/PassCore/PassFieldContent.swift @@ -2,9 +2,9 @@ // Copyright (c) 2025 hiimtmac inc. #if canImport(FoundationEssentials) -import FoundationEssentials +public import FoundationEssentials #else -import Foundation +public import Foundation #endif // https://developer.apple.com/documentation/walletpasses/passfieldcontent diff --git a/Sources/PassCore/RelevantDate.swift b/Sources/PassCore/RelevantDate.swift index 5090ab6..e036a5a 100644 --- a/Sources/PassCore/RelevantDate.swift +++ b/Sources/PassCore/RelevantDate.swift @@ -1,7 +1,11 @@ // RelevantDate.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation +#if canImport(FoundationEssentials) +public import FoundationEssentials +#else +public import Foundation +#endif extension Pass { /// https://developer.apple.com/documentation/walletpasses/pass/relevantdates-data.dictionary diff --git a/Sources/PassCore/SemanticTags.swift b/Sources/PassCore/SemanticTags.swift index fffe464..2279a1f 100644 --- a/Sources/PassCore/SemanticTags.swift +++ b/Sources/PassCore/SemanticTags.swift @@ -1,7 +1,11 @@ // SemanticTags.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation +#if canImport(FoundationEssentials) +public import FoundationEssentials +#else +public import Foundation +#endif // https://developer.apple.com/documentation/walletpasses/semantictags /// An object that contains machine-readable metadata the system uses to offer a pass and suggest related actions. diff --git a/Sources/PassCore/UpcomingPassInformationEntry.swift b/Sources/PassCore/UpcomingPassInformationEntry.swift index 0b92a5d..a8e8ad4 100644 --- a/Sources/PassCore/UpcomingPassInformationEntry.swift +++ b/Sources/PassCore/UpcomingPassInformationEntry.swift @@ -1,7 +1,12 @@ // UpcomingPassInformationEntry.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation +#if canImport(FoundationEssentials) +public import FoundationEssentials +#else +public import Foundation +#endif + // https://developer.apple.com/documentation/walletpasses/upcomingpassinformationentry /// An object that represents the ordered list of all upcoming pass information entries. diff --git a/Sources/PassGen/Manifest.swift b/Sources/PassGen/Manifest.swift index 443747a..124ace4 100644 --- a/Sources/PassGen/Manifest.swift +++ b/Sources/PassGen/Manifest.swift @@ -2,6 +2,7 @@ // Copyright (c) 2025 hiimtmac inc. import Crypto + #if canImport(FoundationEssentials) import FoundationEssentials #else @@ -13,7 +14,9 @@ struct Manifest { mutating func addHash(name: String, data: Data) { let hashData = Insecure.SHA1.hash(data: data) - hashes[name] = hashData.map { String(format: "%02hhx", $0) }.joined() + hashes[name] = hashData.map { String($0, radix: 16, uppercase: false) } + .map { $0.count == 1 ? "0" + $0 : $0 } + .joined() } func makeData() throws -> Data { diff --git a/Sources/PassGen/PassGenerator.swift b/Sources/PassGen/PassGenerator.swift index ad6d21b..ec1a682 100644 --- a/Sources/PassGen/PassGenerator.swift +++ b/Sources/PassGen/PassGenerator.swift @@ -4,11 +4,12 @@ import _CryptoExtras // TODO: `Bundle` is not available in FoundationEssentials // #if canImport(FoundationEssentials) -// import FoundationEssentials +// public import FoundationEssentials // #else -import Foundation +public import Foundation // #endif -import PassCore +public import PassCore +import SwiftASN1 import X509 import ZipArchive diff --git a/Sources/PassGen/PassReader.swift b/Sources/PassGen/PassReader.swift index 242dbef..e34ef35 100644 --- a/Sources/PassGen/PassReader.swift +++ b/Sources/PassGen/PassReader.swift @@ -2,11 +2,12 @@ // Copyright (c) 2025 hiimtmac inc. #if canImport(FoundationEssentials) -import FoundationEssentials +public import FoundationEssentials #else -import Foundation +public import Foundation #endif -import PassCore +public import PassCore +import SystemPackage import ZipArchive extension DecodingError { diff --git a/Sources/PassHelpers/ImageSize.swift b/Sources/PassHelpers/ImageSize.swift index a37d947..d819201 100644 --- a/Sources/PassHelpers/ImageSize.swift +++ b/Sources/PassHelpers/ImageSize.swift @@ -1,7 +1,7 @@ // ImageSize.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation +public import Foundation public enum ImageSize: Hashable { case icon diff --git a/Sources/PassHelpers/Pass+Extensions.swift b/Sources/PassHelpers/Pass+Extensions.swift index 710834e..39ca437 100644 --- a/Sources/PassHelpers/Pass+Extensions.swift +++ b/Sources/PassHelpers/Pass+Extensions.swift @@ -1,8 +1,12 @@ // Pass+Extensions.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation -import PassCore +#if canImport(FoundationEssentials) +public import FoundationEssentials +#else +public import Foundation +#endif +public import PassCore extension Pass { public static func boardingPass( diff --git a/Sources/PassHelpers/PassContainer.swift b/Sources/PassHelpers/PassContainer.swift index 7a14394..b675ee7 100644 --- a/Sources/PassHelpers/PassContainer.swift +++ b/Sources/PassHelpers/PassContainer.swift @@ -1,8 +1,12 @@ // PassContainer.swift // Copyright (c) 2025 hiimtmac inc. +#if canImport(FoundationEssentials) +import FoundationEssentials +#else import Foundation -import PassCore +#endif +public import PassCore // https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/index.html#//apple_ref/doc/uid/TP40012195-CH1-SW1 diff --git a/Sources/PassHelpers/PassFieldContent+Extensions.swift b/Sources/PassHelpers/PassFieldContent+Extensions.swift index 32eb77f..3bf88ae 100644 --- a/Sources/PassHelpers/PassFieldContent+Extensions.swift +++ b/Sources/PassHelpers/PassFieldContent+Extensions.swift @@ -1,8 +1,12 @@ // PassFieldContent+Extensions.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation -import PassCore +#if canImport(FoundationEssentials) +public import FoundationEssentials +#else +public import Foundation +#endif +public import PassCore // MARK: - String diff --git a/Sources/PassHelpers/PassFields+Extensions.swift b/Sources/PassHelpers/PassFields+Extensions.swift index 2991bbf..5626700 100644 --- a/Sources/PassHelpers/PassFields+Extensions.swift +++ b/Sources/PassHelpers/PassFields+Extensions.swift @@ -1,7 +1,7 @@ // PassFields+Extensions.swift // Copyright (c) 2025 hiimtmac inc. -import PassCore +public import PassCore extension PassFields { public static func boardingPass( diff --git a/Sources/PassHelpers/SemanticTags+Extensions.swift b/Sources/PassHelpers/SemanticTags+Extensions.swift index c4bfa34..75c5886 100644 --- a/Sources/PassHelpers/SemanticTags+Extensions.swift +++ b/Sources/PassHelpers/SemanticTags+Extensions.swift @@ -1,8 +1,12 @@ // SemanticTags+Extensions.swift // Copyright (c) 2025 hiimtmac inc. -import Foundation -import PassCore +#if canImport(FoundationEssentials) +public import FoundationEssentials +#else +public import Foundation +#endif +public import PassCore extension SemanticTags { public static func eventSemantics( diff --git a/Sources/PassHelpers/UTType+Extensions.swift b/Sources/PassHelpers/UTType+Extensions.swift index 6db0a6e..ffe78ee 100644 --- a/Sources/PassHelpers/UTType+Extensions.swift +++ b/Sources/PassHelpers/UTType+Extensions.swift @@ -2,7 +2,7 @@ // Copyright (c) 2025 hiimtmac inc. #if canImport(UniformTypeIdentifiers) -import UniformTypeIdentifiers +public import UniformTypeIdentifiers extension UTType { public static let pkpass = UTType("com.apple.pkpass-data")! diff --git a/Tests/PassKitTests/GeneratorTests.swift b/Tests/PassKitTests/GeneratorTests.swift index 22a3b18..48232a6 100644 --- a/Tests/PassKitTests/GeneratorTests.swift +++ b/Tests/PassKitTests/GeneratorTests.swift @@ -3,6 +3,7 @@ import Foundation import Testing +import PassCore @testable import PassGen @Suite diff --git a/Tests/PassKitTests/ReaderTests.swift b/Tests/PassKitTests/ReaderTests.swift index a8bb201..3974878 100644 --- a/Tests/PassKitTests/ReaderTests.swift +++ b/Tests/PassKitTests/ReaderTests.swift @@ -3,6 +3,7 @@ import Foundation import Testing +import PassCore @testable import PassGen @Suite