Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.
Update to Swift 6
Kabir Oberai726919b0f573
diff --git a/Package.resolved b/Package.resolvedindex f6aaa2c..9471da4 100644--- a/Package.resolved+++ b/Package.resolved@@ -1,205 +1,213 @@{- "object": {- "pins": [- {- "package": "async-http-client",- "repositoryURL": "https://github.com/swift-server/async-http-client.git",- "state": {- "branch": null,- "revision": "0a9b72369b9d87ab155ef585ef50700a34abf070",- "version": "1.23.1"- }- },- {- "package": "BigInt",- "repositoryURL": "https://github.com/attaswift/BigInt",- "state": {- "branch": null,- "revision": "a7ee11486233ba45f5ceee0b8cb3d6629ed450ef",- "version": "5.5.0"- }- },- {- "package": "SuperchargeCore",- "repositoryURL": "https://github.com/SuperchargeApp/SuperchargeCore",- "state": {- "branch": null,- "revision": "570d27aa538379f94196ec44bae440ef243bb666",- "version": "1.1.1"- }- },- {- "package": "swift-algorithms",- "repositoryURL": "https://github.com/apple/swift-algorithms.git",- "state": {- "branch": null,- "revision": "f6919dfc309e7f1b56224378b11e28bab5bccc42",- "version": "1.2.0"- }- },- {- "package": "swift-argument-parser",- "repositoryURL": "https://github.com/apple/swift-argument-parser",- "state": {- "branch": null,- "revision": "41982a3656a71c768319979febd796c6fd111d5c",- "version": "1.5.0"- }- },- {- "package": "swift-asn1",- "repositoryURL": "https://github.com/apple/swift-asn1.git",- "state": {- "branch": null,- "revision": "7faebca1ea4f9aaf0cda1cef7c43aecd2311ddf6",- "version": "1.3.0"- }- },- {- "package": "swift-atomics",- "repositoryURL": "https://github.com/apple/swift-atomics.git",- "state": {- "branch": null,- "revision": "cd142fd2f64be2100422d658e7411e39489da985",- "version": "1.2.0"- }- },- {- "package": "swift-certificates",- "repositoryURL": "https://github.com/apple/swift-certificates",- "state": {- "branch": null,- "revision": "1fbb6ef21f1525ed5faf4c95207b9c11bea27e94",- "version": "1.6.1"- }- },- {- "package": "swift-collections",- "repositoryURL": "https://github.com/apple/swift-collections.git",- "state": {- "branch": null,- "revision": "671108c96644956dddcd89dd59c203dcdb36cec7",- "version": "1.1.4"- }- },- {- "package": "swift-crypto",- "repositoryURL": "https://github.com/apple/swift-crypto",- "state": {- "branch": null,- "revision": "06dc63c6d8da54ee11ceb268cde1fa68161afc96",- "version": "3.9.1"- }- },- {- "package": "swift-http-types",- "repositoryURL": "https://github.com/apple/swift-http-types",- "state": {- "branch": null,- "revision": "ef18d829e8b92d731ad27bb81583edd2094d1ce3",- "version": "1.3.1"- }- },- {- "package": "swift-log",- "repositoryURL": "https://github.com/apple/swift-log.git",- "state": {- "branch": null,- "revision": "9cb486020ebf03bfa5b5df985387a14a98744537",- "version": "1.6.1"- }- },- {- "package": "swift-nio",- "repositoryURL": "https://github.com/apple/swift-nio.git",- "state": {- "branch": null,- "revision": "914081701062b11e3bb9e21accc379822621995e",- "version": "2.76.1"- }- },- {- "package": "swift-nio-extras",- "repositoryURL": "https://github.com/apple/swift-nio-extras.git",- "state": {- "branch": null,- "revision": "2e9746cfc57554f70b650b021b6ae4738abef3e6",- "version": "1.24.1"- }- },- {- "package": "swift-nio-http2",- "repositoryURL": "https://github.com/apple/swift-nio-http2.git",- "state": {- "branch": null,- "revision": "eaa71bb6ae082eee5a07407b1ad0cbd8f48f9dca",- "version": "1.34.1"- }- },- {- "package": "swift-nio-ssl",- "repositoryURL": "https://github.com/apple/swift-nio-ssl.git",- "state": {- "branch": null,- "revision": "c7e95421334b1068490b5d41314a50e70bab23d1",- "version": "2.29.0"- }- },- {- "package": "swift-nio-transport-services",- "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",- "state": {- "branch": null,- "revision": "bbd5e63cf949b7db0c9edaf7a21e141c52afe214",- "version": "1.23.0"- }- },- {- "package": "swift-numerics",- "repositoryURL": "https://github.com/apple/swift-numerics.git",- "state": {- "branch": null,- "revision": "0a5bc04095a675662cf24757cc0640aa2204253b",- "version": "1.0.2"- }- },- {- "package": "swift-system",- "repositoryURL": "https://github.com/apple/swift-system.git",- "state": {- "branch": null,- "revision": "c8a44d836fe7913603e246acab7c528c2e780168",- "version": "1.4.0"- }- },- {- "package": "SwiftyMobileDevice",- "repositoryURL": "https://github.com/SuperchargeApp/SwiftyMobileDevice",- "state": {- "branch": null,- "revision": "1823b7de02130e64ca4e42947056f78a85a12b39",- "version": "1.1.1"- }- },- {- "package": "websocket-kit",- "repositoryURL": "https://github.com/vapor/websocket-kit.git",- "state": {- "branch": null,- "revision": "4232d34efa49f633ba61afde365d3896fc7f8740",- "version": "2.15.0"- }- },- {- "package": "zsign",- "repositoryURL": "https://github.com/kabiroberai/zsign",- "state": {- "branch": null,- "revision": "45fa854a214c5a68bd35d1e35e90dfe9be28c7d4",- "version": "1.2.4"- }- }- ]- },- "version": 1+ "originHash" : "f5935ae26f2a05b003fab58924d18ded1d3eb79e578be093e900459aaaae1468",+ "pins" : [+ {+ "identity" : "async-http-client",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/swift-server/async-http-client.git",+ "state" : {+ "revision" : "0a9b72369b9d87ab155ef585ef50700a34abf070",+ "version" : "1.23.1"+ }+ },+ {+ "identity" : "bigint",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/attaswift/BigInt",+ "state" : {+ "revision" : "a7ee11486233ba45f5ceee0b8cb3d6629ed450ef",+ "version" : "5.5.0"+ }+ },+ {+ "identity" : "superchargecore",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/SuperchargeApp/SuperchargeCore",+ "state" : {+ "revision" : "e409f42fd5736fac149c8288eba69c50e7eac5c2",+ "version" : "1.2.0"+ }+ },+ {+ "identity" : "swift-algorithms",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-algorithms.git",+ "state" : {+ "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",+ "version" : "1.2.0"+ }+ },+ {+ "identity" : "swift-argument-parser",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-argument-parser",+ "state" : {+ "revision" : "41982a3656a71c768319979febd796c6fd111d5c",+ "version" : "1.5.0"+ }+ },+ {+ "identity" : "swift-asn1",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-asn1.git",+ "state" : {+ "revision" : "7faebca1ea4f9aaf0cda1cef7c43aecd2311ddf6",+ "version" : "1.3.0"+ }+ },+ {+ "identity" : "swift-atomics",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-atomics.git",+ "state" : {+ "revision" : "cd142fd2f64be2100422d658e7411e39489da985",+ "version" : "1.2.0"+ }+ },+ {+ "identity" : "swift-certificates",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-certificates",+ "state" : {+ "revision" : "1fbb6ef21f1525ed5faf4c95207b9c11bea27e94",+ "version" : "1.6.1"+ }+ },+ {+ "identity" : "swift-collections",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-collections.git",+ "state" : {+ "revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",+ "version" : "1.1.4"+ }+ },+ {+ "identity" : "swift-concurrency-extras",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/pointfreeco/swift-concurrency-extras.git",+ "state" : {+ "revision" : "163409ef7dae9d960b87f34b51587b6609a76c1f",+ "version" : "1.3.0"+ }+ },+ {+ "identity" : "swift-crypto",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-crypto",+ "state" : {+ "revision" : "06dc63c6d8da54ee11ceb268cde1fa68161afc96",+ "version" : "3.9.1"+ }+ },+ {+ "identity" : "swift-http-types",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-http-types",+ "state" : {+ "revision" : "ef18d829e8b92d731ad27bb81583edd2094d1ce3",+ "version" : "1.3.1"+ }+ },+ {+ "identity" : "swift-log",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-log.git",+ "state" : {+ "revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",+ "version" : "1.6.1"+ }+ },+ {+ "identity" : "swift-nio",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-nio.git",+ "state" : {+ "revision" : "914081701062b11e3bb9e21accc379822621995e",+ "version" : "2.76.1"+ }+ },+ {+ "identity" : "swift-nio-extras",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-nio-extras.git",+ "state" : {+ "revision" : "2e9746cfc57554f70b650b021b6ae4738abef3e6",+ "version" : "1.24.1"+ }+ },+ {+ "identity" : "swift-nio-http2",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-nio-http2.git",+ "state" : {+ "revision" : "eaa71bb6ae082eee5a07407b1ad0cbd8f48f9dca",+ "version" : "1.34.1"+ }+ },+ {+ "identity" : "swift-nio-ssl",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-nio-ssl.git",+ "state" : {+ "revision" : "c7e95421334b1068490b5d41314a50e70bab23d1",+ "version" : "2.29.0"+ }+ },+ {+ "identity" : "swift-nio-transport-services",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-nio-transport-services.git",+ "state" : {+ "revision" : "bbd5e63cf949b7db0c9edaf7a21e141c52afe214",+ "version" : "1.23.0"+ }+ },+ {+ "identity" : "swift-numerics",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-numerics.git",+ "state" : {+ "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",+ "version" : "1.0.2"+ }+ },+ {+ "identity" : "swift-system",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/apple/swift-system.git",+ "state" : {+ "revision" : "c8a44d836fe7913603e246acab7c528c2e780168",+ "version" : "1.4.0"+ }+ },+ {+ "identity" : "swiftymobiledevice",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/SuperchargeApp/SwiftyMobileDevice",+ "state" : {+ "revision" : "c7772fb58452c9df727568dda3ca08cf716ef608",+ "version" : "1.2.1"+ }+ },+ {+ "identity" : "websocket-kit",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/vapor/websocket-kit.git",+ "state" : {+ "revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",+ "version" : "2.15.0"+ }+ },+ {+ "identity" : "zsign",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/kabiroberai/zsign",+ "state" : {+ "revision" : "c3fea016227f595cd51f037450650a2ff362f7db",+ "version" : "1.3.0"+ }+ }+ ],+ "version" : 3}diff --git a/Package.swift b/Package.swiftindex 1c5571a..bbb7bb4 100644--- a/Package.swift+++ b/Package.swift@@ -1,4 +1,4 @@-// swift-tools-version:5.3+// swift-tools-version:6.0import PackageDescription@@ -27,15 +27,16 @@ let package = Package(),],dependencies: [- .package(url: "https://github.com/SuperchargeApp/SuperchargeCore", .upToNextMinor(from: "1.1.1")),- .package(url: "https://github.com/SuperchargeApp/SwiftyMobileDevice", .upToNextMinor(from: "1.1.1")),- .package(url: "https://github.com/kabiroberai/zsign", .upToNextMinor(from: "1.2.4")),+ .package(url: "https://github.com/SuperchargeApp/SuperchargeCore", .upToNextMinor(from: "1.2.0")),+ .package(url: "https://github.com/SuperchargeApp/SwiftyMobileDevice", .upToNextMinor(from: "1.2.1")),+ .package(url: "https://github.com/kabiroberai/zsign", .upToNextMinor(from: "1.3.0")),.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.23.0"),.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.15.0"),.package(url: "https://github.com/apple/swift-certificates", from: "1.0.0"),.package(url: "https://github.com/apple/swift-crypto", from: "3.9.1"),.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),.package(url: "https://github.com/attaswift/BigInt", from: "5.5.0"),+ .package(url: "https://github.com/pointfreeco/swift-concurrency-extras.git", from: "1.3.0"),],targets: [.systemLibrary(name: "CSupersette"),@@ -51,6 +52,7 @@ let package = Package(dependencies: ["CSupersign",.byName(name: "CSupersette", condition: .when(platforms: [.linux])),+ .product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),.product(name: "SwiftyMobileDevice", package: "SwiftyMobileDevice"),.product(name: "Zupersign", package: "zsign"),.product(name: "SignerSupport", package: "SuperchargeCore"),@@ -96,7 +98,7 @@ let package = Package(],cSettings: cSettings),- .target(+ .executableTarget(name: "SupersignCLI",dependencies: ["SwiftyMobileDevice",diff --git a/Sources/CSupersign/include/stdout_shim.h b/Sources/CSupersign/include/stdout_shim.hnew file mode 100644index 0000000..1426eb3--- /dev/null+++ b/Sources/CSupersign/include/stdout_shim.h@@ -0,0 +1,5 @@+#include <stdio.h>++inline static FILE *get_stdout() {+ return stdout;+}diff --git a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAddAppGroupRequest.swift b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAddAppGroupRequest.swiftindex ad14360..71ccbb1 100644--- a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAddAppGroupRequest.swift+++ b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAddAppGroupRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesAddAppGroupRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {let applicationGroup: DeveloperServicesAppGroup}public typealias Value = DeveloperServicesAppGroup@@ -29,8 +29,8 @@ public struct DeveloperServicesAddAppGroupRequest: DeveloperServicesPlatformRequ]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.applicationGroup))+ public func parse(_ response: Response) -> DeveloperServicesAppGroup {+ response.applicationGroup}public init(diff --git a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAppGroup.swift b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAppGroup.swiftindex 7e0aedf..0d56123 100644--- a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAppGroup.swift+++ b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAppGroup.swift@@ -8,8 +8,8 @@import Foundation-public struct DeveloperServicesAppGroup: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesAppGroup: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}@@ -17,7 +17,7 @@ public struct DeveloperServicesAppGroup: Decodable {public let name: String- public struct GroupID: RawRepresentable, Hashable, Codable {+ public struct GroupID: RawRepresentable, Hashable, Codable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}diff --git a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swift b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swiftindex f93de5a..c41370e 100644--- a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swift+++ b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swift@@ -8,9 +8,9 @@import Foundation-public class DeveloperServicesAssignAppGroupRequest: DeveloperServicesPlatformRequest {+public final class DeveloperServicesAssignAppGroupRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {}+ public struct Response: Decodable, Sendable {}public typealias Value = Responsepublic let platform: DeveloperServicesPlatformdiff --git a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesListAppGroupsRequest.swift b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesListAppGroupsRequest.swiftindex 4bf05f6..fc1c3d8 100644--- a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesListAppGroupsRequest.swift+++ b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesListAppGroupsRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesListAppGroupsRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let applicationGroupList: [DeveloperServicesAppGroup]}public typealias Value = [DeveloperServicesAppGroup]@@ -23,8 +23,8 @@ public struct DeveloperServicesListAppGroupsRequest: DeveloperServicesPlatformRereturn ["teamId": teamID.rawValue]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.applicationGroupList))+ public func parse(_ response: Response) -> [DeveloperServicesAppGroup] {+ response.applicationGroupList}public init(platform: DeveloperServicesPlatform, teamID: DeveloperServicesTeam.ID) {diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppIDRequest.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppIDRequest.swiftindex b1a6017..d8095f7 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppIDRequest.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppIDRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesAddAppIDRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {let appId: DeveloperServicesAppID}public typealias Value = DeveloperServicesAppID@@ -41,8 +41,8 @@ public struct DeveloperServicesAddAppIDRequest: DeveloperServicesPlatformRequestreturn parameters}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.appId))+ public func parse(_ response: Response) -> DeveloperServicesAppID {+ response.appId}public init(diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swiftindex 1737089..1a87592 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift@@ -98,7 +98,7 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {var entitlements: Entitlements// if the executable doesn't already have entitlements, that's// okay. We don't have to throw an error.- if let entitlementsData = try? context.signerImpl.analyze(executable: executableURL),+ if let entitlementsData = try? await context.signerImpl.analyze(executable: executableURL),let decodedEntitlements = try? PropertyListDecoder().decode(Entitlements.self, from: entitlementsData) {entitlements = decodedEntitlementsdiff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swiftindex e70f1b5..05de452 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swift@@ -9,8 +9,8 @@import Foundationimport ProtoCodable-public struct DeveloperServicesAppID: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesAppID: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesDeleteAppIDRequest.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesDeleteAppIDRequest.swiftindex 0874ea3..2808da4 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesDeleteAppIDRequest.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesDeleteAppIDRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesDeleteAppIDRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {}+ public struct Response: Decodable, Sendable {}public typealias Value = Responsepublic let platform: DeveloperServicesPlatformdiff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesListAppIDsRequest.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesListAppIDsRequest.swiftindex f1fa0e5..45fe66f 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesListAppIDsRequest.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesListAppIDsRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesListAppIDsRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let appIds: [DeveloperServicesAppID]}public typealias Value = [DeveloperServicesAppID]@@ -23,8 +23,8 @@ public struct DeveloperServicesListAppIDsRequest: DeveloperServicesPlatformRequereturn ["teamId": teamID.rawValue]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.appIds))+ public func parse(_ response: Response) -> [DeveloperServicesAppID] {+ response.appIds}public init(platform: DeveloperServicesPlatform, teamID: DeveloperServicesTeam.ID) {diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swiftindex f4706a7..acfdb1f 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesUpdateAppIDRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {let appId: DeveloperServicesAppID}public typealias Value = DeveloperServicesAppID@@ -39,8 +39,8 @@ public struct DeveloperServicesUpdateAppIDRequest: DeveloperServicesPlatformRequreturn parameters}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.appId))+ public func parse(_ response: Response) -> DeveloperServicesAppID {+ response.appId}public init(diff --git a/Sources/Supersign/DeveloperServices/App IDs/Features/DeveloperServicesFeature.swift b/Sources/Supersign/DeveloperServices/App IDs/Features/DeveloperServicesFeature.swiftindex 79fb4fc..c1f2086 100644--- a/Sources/Supersign/DeveloperServices/App IDs/Features/DeveloperServicesFeature.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/Features/DeveloperServicesFeature.swift@@ -9,6 +9,6 @@import Foundationimport ProtoCodable-public protocol DeveloperServicesFeature: ProtoCodable {+public protocol DeveloperServicesFeature: ProtoCodable, Sendable {static var identifier: String { get }}diff --git a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swift b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swiftindex 8cc916c..03310eb 100644--- a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swift+++ b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swift@@ -8,8 +8,8 @@import Foundation-public struct DeveloperServicesCSRResponse: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesCSRResponse: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}diff --git a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swift b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swiftindex 4e459a0..189cdee 100644--- a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swift+++ b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swift@@ -8,19 +8,19 @@import Foundation-public struct DeveloperServicesCertificate: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesCertificate: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}public let id: ID- public struct SerialNumber: RawRepresentable, Decodable {+ public struct SerialNumber: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}- public enum Kind: String, Decodable, CaseIterable {+ public enum Kind: String, Decodable, CaseIterable, Sendable {case development = "DEVELOPMENT"case distribution = "DISTRIBUTION"case iOSDevelopment = "IOS_DEVELOPMENT"@@ -44,7 +44,7 @@ public struct DeveloperServicesCertificate: Decodable {}}- public struct Attributes: Decodable {+ public struct Attributes: Decodable, Sendable {public let serialNumber: SerialNumberpublic let name: Stringpublic let kind: Kinddiff --git a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swift b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swiftindex 57ab49f..cf5287b 100644--- a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swift+++ b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swift@@ -29,10 +29,10 @@ public struct DeveloperServicesFetchCertificateOperation: DeveloperServicesOpera}public let context: SigningContext- public let confirmRevocation: ([DeveloperServicesCertificate]) async -> Bool+ public let confirmRevocation: @Sendable ([DeveloperServicesCertificate]) async -> Boolpublic init(context: SigningContext,- confirmRevocation: @escaping ([DeveloperServicesCertificate]) async -> Bool+ confirmRevocation: @escaping @Sendable ([DeveloperServicesCertificate]) async -> Bool) {self.context = contextself.confirmRevocation = confirmRevocationdiff --git a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swift b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swiftindex 4b0a05c..f927908 100644--- a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swift+++ b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swift@@ -8,7 +8,7 @@import Foundation-public struct DeveloperServicesListCertificatesRequest: DeveloperServicesRequest {+public struct DeveloperServicesListCertificatesRequest: DeveloperServicesRequest, Sendable {public typealias Response = [DeveloperServicesCertificate]public typealias Value = Responsediff --git a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesSubmitCSRRequest.swift b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesSubmitCSRRequest.swiftindex 76cae21..010104b 100644--- a/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesSubmitCSRRequest.swift+++ b/Sources/Supersign/DeveloperServices/Certificates/DeveloperServicesSubmitCSRRequest.swift@@ -8,9 +8,9 @@import Foundation-public class DeveloperServicesSubmitCSRRequest: DeveloperServicesPlatformRequest {+public final class DeveloperServicesSubmitCSRRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let certRequest: DeveloperServicesCSRResponse}public typealias Value = DeveloperServicesCSRResponse@@ -31,8 +31,8 @@ public class DeveloperServicesSubmitCSRRequest: DeveloperServicesPlatformRequest]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.certRequest))+ public func parse(_ response: Response) -> DeveloperServicesCSRResponse {+ response.certRequest}public init(diff --git a/Sources/Supersign/DeveloperServices/Developer/DeveloperServicesViewDeveloperRequest.swift b/Sources/Supersign/DeveloperServices/Developer/DeveloperServicesViewDeveloperRequest.swiftindex e4a69e0..e2755f6 100644--- a/Sources/Supersign/DeveloperServices/Developer/DeveloperServicesViewDeveloperRequest.swift+++ b/Sources/Supersign/DeveloperServices/Developer/DeveloperServicesViewDeveloperRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesViewDeveloperRequest: DeveloperServicesRequest {- public struct Developer: Decodable {+ public struct Developer: Decodable, Sendable {public let email: Stringpublic let firstName: String@@ -22,7 +22,7 @@ public struct DeveloperServicesViewDeveloperRequest: DeveloperServicesRequest {public let developerStatus: String}- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {let developer: Developer}public typealias Value = Developer@@ -30,8 +30,8 @@ public struct DeveloperServicesViewDeveloperRequest: DeveloperServicesRequest {public var action: String { return "viewDeveloper" }public var parameters: [String: Any] { return [:] }- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.developer))+ public func parse(_ response: Response) -> Developer {+ response.developer}public init() {}diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swiftindex 051facd..9cb0af3 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swift@@ -9,7 +9,7 @@import Foundationimport Superutils-public protocol DeveloperServicesAPIVersion {+public protocol DeveloperServicesAPIVersion: Sendable {func url(forAction action: String) -> URL?var contentType: String { get }var accept: String { get }diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swiftindex d28f7df..6d52b91 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift@@ -8,7 +8,7 @@import Foundation-public final class DeveloperServicesClient {+public final class DeveloperServicesClient: Sendable {public enum Error: LocalizedError {case noData@@ -111,9 +111,7 @@ public final class DeveloperServicesClient {let decoded: R.Response = try request.apiVersion.decode(response: data)- return try await withCheckedThrowingContinuation { continuation in- request.parse(decoded) { continuation.resume(with: $0) }- }+ return try await request.parse(decoded)}public func send<R: DeveloperServicesRequest>(_ request: R) async throws -> R.Value {@@ -121,16 +119,4 @@ public final class DeveloperServicesClient {return try await self.send(request, anisetteData: anisetteData)}- @available(*, deprecated, message: "Use async overload")- public func send<R: DeveloperServicesRequest>(- _ request: R,- completion: @escaping (Result<R.Value, Swift.Error>) -> Void- ) {- Task {- completion(await Result {- try await send(request)- })- }- }-}diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swiftindex 7ce2837..e9df8d7 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift@@ -8,7 +8,7 @@import Foundation-public struct DeveloperServicesLoginToken: Codable {+public struct DeveloperServicesLoginToken: Codable, Sendable {public let adsid: Stringpublic let token: Stringpublic let expiry: Date@@ -20,7 +20,7 @@ public struct DeveloperServicesLoginToken: Codable {}}-public struct DeveloperServicesLoginManager {+public struct DeveloperServicesLoginManager: Sendable {public enum Error: Swift.Error {case missingLoginToken@@ -71,22 +71,4 @@ public struct DeveloperServicesLoginManager {return try await self.logIn(withLoginData: loginData)}- @available(*, deprecated, message: "Use async overload")- public func logIn(- withUsername username: String,- password: String,- twoFactorDelegate: TwoFactorAuthDelegate,- completion: @escaping (Result<DeveloperServicesLoginToken, Swift.Error>) -> Void- ) {- Task {- completion(await Result {- try await logIn(- withUsername: username,- password: password,- twoFactorDelegate: twoFactorDelegate- )- })- }- }-}diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesOperation.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesOperation.swiftindex 83299e7..6945027 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesOperation.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesOperation.swift@@ -8,7 +8,7 @@import Foundation-public protocol DeveloperServicesOperation {+public protocol DeveloperServicesOperation: Sendable {associatedtype Responsevar context: SigningContext { get }diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swiftindex e186918..2992c7f 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift@@ -8,7 +8,7 @@import Foundation-public enum DeveloperServicesPlatform: Decodable, Hashable {+public enum DeveloperServicesPlatform: Decodable, Hashable, Sendable {private static let known: ([String: DeveloperServicesPlatform], [DeveloperServicesPlatform: String]) = {var first: [String: DeveloperServicesPlatform] = [:]var second: [DeveloperServicesPlatform: String] = [:]diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesProvisioningOperation.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesProvisioningOperation.swiftindex 37301a3..198826b 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesProvisioningOperation.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesProvisioningOperation.swift@@ -8,7 +8,7 @@import Foundation-public struct ProvisioningInfo {+public struct ProvisioningInfo: Sendable {public let newBundleID: Stringpublic let entitlements: Entitlementspublic let mobileprovision: Mobileprovision@@ -23,13 +23,13 @@ public struct DeveloperServicesProvisioningOperation: DeveloperServicesOperationpublic let context: SigningContextpublic let app: URL- public let confirmRevocation: ([DeveloperServicesCertificate]) async -> Bool- public let progress: (Double) -> Void+ public let confirmRevocation: @Sendable ([DeveloperServicesCertificate]) async -> Bool+ public let progress: @Sendable (Double) -> Voidpublic init(context: SigningContext,app: URL,- confirmRevocation: @escaping ([DeveloperServicesCertificate]) async -> Bool,- progress: @escaping (Double) -> Void+ confirmRevocation: @escaping @Sendable ([DeveloperServicesCertificate]) async -> Bool,+ progress: @escaping @Sendable (Double) -> Void) {self.context = contextself.app = appdiff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesRequest.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesRequest.swiftindex 5ff9d44..bd43998 100644--- a/Sources/Supersign/DeveloperServices/DeveloperServicesRequest.swift+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesRequest.swift@@ -8,12 +8,12 @@import Foundation-public struct EmptyResponse: Decodable {}+public struct EmptyResponse: Decodable, Sendable {}-public protocol DeveloperServicesRequest {+public protocol DeveloperServicesRequest: Sendable {- associatedtype Response: Decodable- associatedtype Value+ associatedtype Response: Decodable, Sendable+ associatedtype Value: Sendablevar apiVersion: DeveloperServicesAPIVersion { get }@@ -23,7 +23,7 @@ public protocol DeveloperServicesRequest {func configure(urlRequest: inout HTTPRequest)- func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void)+ func parse(_ response: Response) async throws -> Value}public extension DeveloperServicesRequest {@@ -33,7 +33,7 @@ public extension DeveloperServicesRequest {}public extension DeveloperServicesRequest where Response == Value {- func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response))+ func parse(_ response: Response) -> Response {+ response}}diff --git a/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesAddDeviceRequest.swift b/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesAddDeviceRequest.swiftindex c35f964..a4ebbf6 100644--- a/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesAddDeviceRequest.swift+++ b/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesAddDeviceRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesAddDeviceRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {let device: DeveloperServicesDevice}public typealias Value = DeveloperServicesDevice@@ -29,8 +29,8 @@ public struct DeveloperServicesAddDeviceRequest: DeveloperServicesPlatformReques]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.device))+ public func parse(_ response: Response) -> DeveloperServicesDevice {+ response.device}public init(diff --git a/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesDevice.swift b/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesDevice.swiftindex 6ec7aa8..5cfe7de 100644--- a/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesDevice.swift+++ b/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesDevice.swift@@ -8,8 +8,8 @@import Foundation-public struct DeveloperServicesDevice: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesDevice: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}diff --git a/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesListDevicesRequest.swift b/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesListDevicesRequest.swiftindex 06bba5c..2801104 100644--- a/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesListDevicesRequest.swift+++ b/Sources/Supersign/DeveloperServices/Devices/DeveloperServicesListDevicesRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesListDevicesRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let devices: [DeveloperServicesDevice]}public typealias Value = [DeveloperServicesDevice]@@ -27,8 +27,8 @@ public struct DeveloperServicesListDevicesRequest: DeveloperServicesPlatformRequ]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.devices))+ public func parse(_ response: Response) -> Value {+ response.devices}public init(platform: DeveloperServicesPlatform, teamID: DeveloperServicesTeam.ID) {diff --git a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesDeleteProfileRequest.swift b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesDeleteProfileRequest.swiftindex d5d9c06..20513f8 100644--- a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesDeleteProfileRequest.swift+++ b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesDeleteProfileRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesDeleteProfileRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {}+ public struct Response: Decodable, Sendable {}public typealias Value = Responsepublic let platform: DeveloperServicesPlatformdiff --git a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesGetProfileRequest.swift b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesGetProfileRequest.swiftindex c23ded1..e78863e 100644--- a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesGetProfileRequest.swift+++ b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesGetProfileRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesGetProfileRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let provisioningProfile: DeveloperServicesProfile}public typealias Value = DeveloperServicesProfile@@ -24,8 +24,8 @@ public struct DeveloperServicesGetProfileRequest: DeveloperServicesPlatformRequereturn ["teamId": teamID.rawValue, "appIdId": appIDID.rawValue]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.provisioningProfile))+ public func parse(_ response: Response) -> DeveloperServicesProfile {+ response.provisioningProfile}public init(diff --git a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesListProfilesRequest.swift b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesListProfilesRequest.swiftindex 0166972..c6f1439 100644--- a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesListProfilesRequest.swift+++ b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesListProfilesRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesListProfilesRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let provisioningProfiles: [DeveloperServicesProfile]}public typealias Value = [DeveloperServicesProfile]@@ -23,8 +23,8 @@ public struct DeveloperServicesListProfilesRequest: DeveloperServicesPlatformReqreturn ["teamId": teamID.rawValue]}- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.provisioningProfiles))+ public func parse(_ response: Response) -> [DeveloperServicesProfile] {+ response.provisioningProfiles}public init(platform: DeveloperServicesPlatform, teamID: DeveloperServicesTeam.ID) {diff --git a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesProfile.swift b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesProfile.swiftindex e09f237..937c095 100644--- a/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesProfile.swift+++ b/Sources/Supersign/DeveloperServices/Profiles/DeveloperServicesProfile.swift@@ -8,8 +8,8 @@import Foundation-public struct DeveloperServicesProfile: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesProfile: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}diff --git a/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesListTeamsRequest.swift b/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesListTeamsRequest.swiftindex 4397070..f97dd1d 100644--- a/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesListTeamsRequest.swift+++ b/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesListTeamsRequest.swift@@ -10,7 +10,7 @@ import Foundationpublic struct DeveloperServicesListTeamsRequest: DeveloperServicesRequest {- public struct Response: Decodable {+ public struct Response: Decodable, Sendable {public let teams: [DeveloperServicesTeam]}public typealias Value = [DeveloperServicesTeam]@@ -18,10 +18,8 @@ public struct DeveloperServicesListTeamsRequest: DeveloperServicesRequest {public var action: String { return "listTeams" }public var parameters: [String: Any] { return [:] }- public func parse(- _ response: Response, completion: @escaping (Result<[DeveloperServicesTeam], Error>) -> Void- ) {- completion(.success(response.teams))+ public func parse(_ response: Response) -> [DeveloperServicesTeam] {+ response.teams}public init() {}diff --git a/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesTeam.swift b/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesTeam.swiftindex 2f2ab13..039c73d 100644--- a/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesTeam.swift+++ b/Sources/Supersign/DeveloperServices/Teams/DeveloperServicesTeam.swift@@ -8,8 +8,8 @@import Foundation-public struct DeveloperServicesTeam: Decodable {- public struct ID: RawRepresentable, Decodable {+public struct DeveloperServicesTeam: Decodable, Sendable {+ public struct ID: RawRepresentable, Decodable, Sendable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}@@ -18,7 +18,7 @@ public struct DeveloperServicesTeam: Decodable {public let status: Stringpublic let name: String- public struct Membership: Decodable {+ public struct Membership: Decodable, Sendable {public let name: Stringpublic let platform: DeveloperServicesPlatform}diff --git a/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift b/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swiftindex af3cefc..d45d3ae 100644--- a/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift+++ b/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift@@ -1,7 +1,8 @@import Foundationimport Crypto+import ConcurrencyExtras-public protocol RawADIProvider {+public protocol RawADIProvider: Sendable {func clientInfo() async throws -> Stringfunc startProvisioning(@@ -25,7 +26,7 @@ extension RawADIProvider {}}-public protocol RawADIProvisioningSession {+public protocol RawADIProvisioningSession: Sendable {func endProvisioning(routingInfo: UInt64,ptm: Data,@@ -52,7 +53,7 @@ public final class ADIDataProvider: AnisetteDataProvider {private let localUserUID: UUIDprivate let localUserID: String- private var _clientInfo: String?+ private let _clientInfo = LockIsolated<String?>(nil)public init(rawProvider: RawADIProvider,@@ -127,9 +128,9 @@ public final class ADIDataProvider: AnisetteDataProvider {}()private func clientInfo() async throws -> String {- if let _clientInfo { return _clientInfo }+ if let clientInfo = _clientInfo.value { return clientInfo }let clientInfo = try await rawProvider.clientInfo()- self._clientInfo = clientInfo+ _clientInfo.setValue(clientInfo)return clientInfo}diff --git a/Sources/Supersign/GrandSlam/Anisette/AnisetteDataProvider.swift b/Sources/Supersign/GrandSlam/Anisette/AnisetteDataProvider.swiftindex 851a9c7..14fc1ed 100644--- a/Sources/Supersign/GrandSlam/Anisette/AnisetteDataProvider.swift+++ b/Sources/Supersign/GrandSlam/Anisette/AnisetteDataProvider.swift@@ -8,7 +8,7 @@import Foundation-public protocol AnisetteDataProvider {+public protocol AnisetteDataProvider: Sendable {// This is a suggestion and not a requirement.func resetProvisioning() asyncfunc provisioningData() -> ProvisioningData?@@ -16,7 +16,7 @@ public protocol AnisetteDataProvider {func fetchAnisetteData() async throws -> AnisetteData}-public struct ProvisioningData: Hashable, Codable {+public struct ProvisioningData: Hashable, Codable, Sendable {public var localUserUID: UUIDpublic var routingInfo: UInt64public var adiPb: Datadiff --git a/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swift b/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swiftindex fa0e27f..444c718 100644--- a/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swift+++ b/Sources/Supersign/GrandSlam/Anisette/DeviceInfo.swift@@ -8,7 +8,7 @@import Foundation-public struct DeviceInfo: Codable {+public struct DeviceInfo: Codable, Sendable {/// `X-Xcode-Version`static let xcodeVersionKey = "X-Xcode-Version"diff --git a/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift b/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swiftindex 2fc8974..7d4f9be 100644--- a/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift+++ b/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift@@ -3,7 +3,7 @@import Foundationimport CSupersette-public struct SupersetteADIProvider: RawADIProvider {+public actor SupersetteADIProvider: RawADIProvider {@MainActor private static var loadTask: Task<Void, Error>?public let directory: URL@@ -27,14 +27,14 @@ public struct SupersetteADIProvider: RawADIProvider {let applemusic = tmp.appending(path: "applemusic.apk")if !applemusic.exists {print("[Downloading libraries] ...", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)let url = URL(string: "https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk")!defer { print("") }let data = try await httpClient.makeRequest(HTTPRequest(url: url)) { progress inguard let progress else { return }let progString = "\(Int(progress * 100))%".padding(toLength: 4, leading: true)print("\r[Downloading libraries] \(progString)", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)}.body!try data.write(to: applemusic)}@@ -48,6 +48,7 @@ public struct SupersetteADIProvider: RawADIProvider {#endiflet archDir = "lib/\(arch)"+ // TODO: Use ZIPFoundationlet proc = Process()proc.executableURL = URL(filePath: "/usr/bin/unzip")proc.arguments = [diff --git a/Sources/Supersign/GrandSlam/GrandSlamClient.swift b/Sources/Supersign/GrandSlam/GrandSlamClient.swiftindex 5c82bf7..7ddd39a 100644--- a/Sources/Supersign/GrandSlam/GrandSlamClient.swift+++ b/Sources/Supersign/GrandSlam/GrandSlamClient.swift@@ -8,7 +8,7 @@import Foundation-class GrandSlamClient {+final class GrandSlamClient: Sendable {private let encoder = PropertyListEncoder()@@ -52,9 +52,4 @@ class GrandSlamClient {return try R.Decoder.decode(data: resp.body ?? .init())}- @available(*, deprecated, message: "Use async overload")- func send<R: GrandSlamRequest>(_ request: R, completion: @escaping (Result<R.Decoder.Value, Swift.Error>) -> Void) {- Task { completion(await Result { try await send(request) }) }- }-}diff --git a/Sources/Supersign/GrandSlam/Lookup/GrandSlamEndpoints.swift b/Sources/Supersign/GrandSlam/Lookup/GrandSlamEndpoints.swiftindex 3dd2fec..a6bb7a8 100644--- a/Sources/Supersign/GrandSlam/Lookup/GrandSlamEndpoints.swift+++ b/Sources/Supersign/GrandSlam/Lookup/GrandSlamEndpoints.swift@@ -17,7 +17,7 @@ struct GrandSlamEndpoints: Decodable {let midFinishProvisioning: String}-enum GrandSlamEndpoint {- case lookup(KeyPath<GrandSlamEndpoints, String>)+enum GrandSlamEndpoint: Sendable {+ case lookup(KeyPath<GrandSlamEndpoints, String> & Sendable)case url(URL)}diff --git a/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift b/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swiftindex 709e922..0ea3c24 100644--- a/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift+++ b/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift@@ -8,7 +8,7 @@import Foundation-class GrandSlamLookupManager {+actor GrandSlamLookupManager {private static let lookupURL = URL(string: "https://gsa.apple.com/grandslam/GsService2/lookup")!diff --git a/Sources/Supersign/GrandSlam/Operations/GrandSlamTwoFactorAuthenticateOperation.swift b/Sources/Supersign/GrandSlam/Operations/GrandSlamTwoFactorAuthenticateOperation.swiftindex 3274efa..2d4131d 100644--- a/Sources/Supersign/GrandSlam/Operations/GrandSlamTwoFactorAuthenticateOperation.swift+++ b/Sources/Supersign/GrandSlam/Operations/GrandSlamTwoFactorAuthenticateOperation.swift@@ -8,7 +8,7 @@import Foundation-public protocol TwoFactorAuthDelegate: AnyObject {+public protocol TwoFactorAuthDelegate: AnyObject, Sendable {func fetchCode() async -> String?}diff --git a/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift b/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swiftindex fa6055d..2b4578f 100644--- a/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift+++ b/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift@@ -25,7 +25,7 @@ protocol GrandSlamDataDecoder {static func decode(data: Data) throws -> Value}-protocol GrandSlamRequest {+protocol GrandSlamRequest: Sendable {associatedtype Decoder: GrandSlamDataDecoderstatic var endpoint: GrandSlamEndpoint { get }diff --git a/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift b/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swiftindex c39bcb4..8895e4f 100644--- a/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift+++ b/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift@@ -16,7 +16,7 @@ import WebSocketKitextension HTTPClient: HTTPClientProtocol {@discardableResult- public func makeRequest(_ request: HTTPRequest, onProgress: (Double?) -> Void) async throws -> HTTPResponse {+ public func makeRequest(_ request: HTTPRequest, onProgress: sending @isolated(any) (Double?) -> Void) async throws -> HTTPResponse {// print("Requesting \(request.url)")var httpRequest = HTTPClientRequest(url: request.url.absoluteString)httpRequest.method = request.method.map(HTTPMethod.init(rawValue:)) ?? .GET@@ -30,13 +30,13 @@ extension HTTPClient: HTTPClientProtocol {let response = try await execute(httpRequest, deadline: .distantFuture)let expectedBytes = response.headers.first(name: "content-length").flatMap(Int.init).map(Double.init)if expectedBytes == nil {- onProgress(nil)+ await onProgress(nil)}var body = Data()for try await chunk in response.body {body += chunk.readableBytesViewif let expectedBytes {- onProgress(min(Double(body.count) / expectedBytes, 1))+ await onProgress(min(Double(body.count) / expectedBytes, 1))}}return HTTPResponse(@@ -73,7 +73,7 @@ extension HTTPClient: HTTPClientProtocol {private final class WebSocketSessionWrapper: WebSocketSession {let webSocket: WebSocketlet stream: AsyncStream<WebSocketMessage>- private let finishStream: () -> Void+ private let finishStream: @Sendable () -> Voidinit(webSocket: WebSocket) {self.webSocket = webSocketdiff --git a/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift b/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swiftindex eedf727..9b40f73 100644--- a/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift+++ b/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift@@ -7,8 +7,8 @@import Foundation-public struct HTTPRequest {- public enum Body {+public struct HTTPRequest: Sendable {+ public enum Body: Sendable {case buffer(Data)}@@ -30,7 +30,7 @@ public struct HTTPRequest {}}-public struct HTTPResponse {+public struct HTTPResponse: Sendable {public var url: URLpublic var status: Intpublic var headers: [String: String]@@ -49,8 +49,11 @@ public struct HTTPResponse {}}-public protocol HTTPClientProtocol {- func makeRequest(_ request: HTTPRequest, onProgress: (Double?) -> Void) async throws -> HTTPResponse+public protocol HTTPClientProtocol: Sendable {+ func makeRequest(+ _ request: HTTPRequest,+ onProgress: sending @isolated(any) (Double?) -> Void+ ) async throws -> HTTPResponsefunc makeWebSocket(url: URL) async throws -> WebSocketSession}@@ -60,18 +63,18 @@ extension HTTPClientProtocol {}}-public protocol WebSocketSession {+public protocol WebSocketSession: Sendable {func receive() async throws -> WebSocketMessagefunc send(_ message: WebSocketMessage) async throwsfunc close()}-public enum WebSocketMessage {+public enum WebSocketMessage: Sendable {case text(String)case data(Data)}-public protocol HTTPClientFactory {+public protocol HTTPClientFactory: Sendable {func shutdown() // client is invalidated after thisfunc makeClient() -> HTTPClientProtocol}diff --git a/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift b/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swiftindex 4559f7c..5b316fe 100644--- a/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift+++ b/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift@@ -7,6 +7,7 @@#if !os(Linux)import Foundation+import ConcurrencyExtraspublic struct UnknownHTTPError: Error {}@@ -21,14 +22,16 @@ final class URLHTTPClientFactory: HTTPClientFactory {private final class Client: HTTPClientProtocol {final class ClientDelegate: NSObject, URLSessionWebSocketDelegate {- var webSocketCallbacks: [URLSessionWebSocketTask: (URLSessionWebSocketTask.CloseCode?) -> Void] = [:]+ let webSocketCallbacks = LockIsolated<[+ URLSessionWebSocketTask: @Sendable (URLSessionWebSocketTask.CloseCode?) -> Void+ ]>([:])func urlSession(_ session: URLSession,webSocketTask: URLSessionWebSocketTask,didOpenWithProtocol protocol: String?) {- webSocketCallbacks.removeValue(forKey: webSocketTask)?(nil)+ webSocketCallbacks.withValue { $0.removeValue(forKey: webSocketTask) }?(nil)}func urlSession(@@ -37,7 +40,7 @@ private final class Client: HTTPClientProtocol {didCloseWith closeCode: URLSessionWebSocketTask.CloseCode,reason: Data?) {- webSocketCallbacks.removeValue(forKey: webSocketTask)?(closeCode)+ webSocketCallbacks.withValue { $0.removeValue(forKey: webSocketTask) }?(closeCode)}}@@ -53,7 +56,7 @@ private final class Client: HTTPClientProtocol {public func makeRequest(_ request: HTTPRequest,- onProgress: @isolated(any) (Double?) -> Void+ onProgress: sending @isolated(any) (Double?) -> Void) async throws -> HTTPResponse {final class ProgressDelegate: NSObject, URLSessionDataDelegate {private let progressContinuation: AsyncStream<Double>.Continuation@@ -130,9 +133,11 @@ private final class Client: HTTPClientProtocol {public func makeWebSocket(url: URL) async throws -> any WebSocketSession {let task = session.webSocketTask(with: url)let (event, eventContinuation) = AsyncStream<URLSessionWebSocketTask.CloseCode?>.makeStream()- clientDelegate.webSocketCallbacks[task] = {- eventContinuation.yield($0)- eventContinuation.finish()+ clientDelegate.webSocketCallbacks.withValue {+ $0[task] = {+ eventContinuation.yield($0)+ eventContinuation.finish()+ }}let code = await event.first { _ in true } ?? nilif let code { throw Errors.webSocketClosed(code) }diff --git a/Sources/Supersign/Installation/AppInstaller.swift b/Sources/Supersign/Installation/AppInstaller.swiftindex f1ca91f..60deea9 100644--- a/Sources/Supersign/Installation/AppInstaller.swift+++ b/Sources/Supersign/Installation/AppInstaller.swift@@ -9,7 +9,7 @@import Foundationimport SwiftyMobileDevice-public final class AppInstaller {+public actor AppInstaller {public enum Error: LocalizedError {case userCancelled@@ -33,7 +33,7 @@ public final class AppInstaller {}}- public enum Stage {+ public enum Stage: Sendable {case connecting(Double)case uploading(Double)case installing(String, Double?)@@ -80,14 +80,6 @@ public final class AppInstaller {label: "com.kabiroberai.Supersign.install-queue")- private var needsCancellation = false- // throws `Error.userCancelled` if the user cancelled this operation- private func cancelPoint() throws {- if needsCancellation {- throw Error.userCancelled- }- }-public let ipa: URLpublic let udid: Stringpublic let connectionPreferences: Connection.Preferences@@ -102,58 +94,40 @@ public final class AppInstaller {}// synchronous- private func installSync(progress: @escaping (Stage) -> Void) throws {- defer { needsCancellation = false }- try cancelPoint()-- let connection = try Connection.connection(+ public func install(progress: @escaping @Sendable (Stage) -> Void) async throws {+ let connection = try await Connection.connection(forUDID: udid,preferences: connectionPreferences) {progress(.connecting($0 * 4/6))}- try cancelPoint()+ try Task.checkCancellation()- let uploader = try IPAUploader(connection: connection)+ let uploader = try await IPAUploader(connection: connection)progress(.connecting(5/6))- try cancelPoint()+ try Task.checkCancellation()// we need to start the installer quickly because sometimes it fails if we do it after// uploading the ipa to the device- let installer = try IPAInstaller(connection: connection)+ let installer = try await IPAInstaller(connection: connection)progress(.connecting(6/6))- try cancelPoint()+ try Task.checkCancellation()- let uploaded = try uploader.upload(app: ipa) { currentProgress in+ let uploaded = try await uploader.upload(app: ipa) { currentProgress inprogress(.uploading(currentProgress))}defer { uploaded.delete() }- try cancelPoint()+ try Task.checkCancellation()- try installer.install(uploaded: uploaded) { currentProgress in+ try await installer.install(uploaded: uploaded) { currentProgress inprogress(.installing(currentProgress.details, currentProgress.progress))}_ = connection}- public func install(- progress: @escaping (Stage) -> Void,- completion: @escaping (Result<(), Swift.Error>) -> Void- ) {- installQueue.async {- completion(Result {- try self.installSync(progress: progress)- })- }- }-- public func cancel() {- needsCancellation = true- }-}diff --git a/Sources/Supersign/Installation/Connection.swift b/Sources/Supersign/Installation/Connection.swiftindex 46c7283..92d4199 100644--- a/Sources/Supersign/Installation/Connection.swift+++ b/Sources/Supersign/Installation/Connection.swift@@ -9,17 +9,18 @@import Foundationimport SwiftyMobileDevice-private class WeakBox<T: AnyObject> {+private struct Weak<T: AnyObject> {weak var value: T?init(_ value: T) { self.value = value }}+extension Weak: Sendable where T: Sendable {}// there is guaranteed to be at most one Connection instance per (udid, preferences)-// at any moment, thanks to Connection.connection(...). Consequently-// there is at most one device per (udid, preferences) at any moment too.-public class Connection {+// at any moment, thanks to the object pool. Consequently there is at most one device+// per (udid, preferences) at any moment too.+public actor Connection {- public enum LookupHandler: Hashable {+ public enum LookupHandler: Hashable, Sendable {case system(LookupMode)case custom(any ConnectionLookupHandler)@@ -46,7 +47,7 @@ public class Connection {}}- public struct Preferences: Hashable {+ public struct Preferences: Hashable, Sendable {public var lookupHandler: LookupHandlerpublic init(lookupMode: LookupMode) {@@ -68,9 +69,7 @@ public class Connection {}private static let label = "supersign"-- private static var connections: [ConnectionDescriptor: WeakBox<Connection>] = [:]- private static let connectionsQueue = DispatchQueue(label: "connections-queue")+ private static let pool = WeakPool<ConnectionDescriptor, Connection, Error>()private var handle: AnyObject?private let heartbeatHandler: HeartbeatHandler@@ -83,7 +82,7 @@ public class Connection {udid: String,preferences: Preferences,progress: (Double) -> Void- ) throws {+ ) async throws {progress(0/4)self.preferences = preferences@@ -111,22 +110,14 @@ public class Connection {public static func connection(forUDID udid: String,preferences: Preferences,- progress: (Double) -> Void- ) throws -> Connection {- let descriptor = ConnectionDescriptor(udid: udid, preferences: preferences)- return try connectionsQueue.sync {- progress(0)- if let conn = connections[descriptor]?.value {- progress(1)- return conn- }- let conn = try Connection(- udid: udid,- preferences: preferences,- progress: progress- )- connections[descriptor] = WeakBox(conn)- return conn+ progress: @escaping @Sendable (Double) -> Void+ ) async throws -> Connection {+ progress(0)+ defer { progress(1) }+ return try await Self.pool.value(+ key: ConnectionDescriptor(udid: udid, preferences: preferences)+ ) {+ try await Connection(udid: udid, preferences: preferences, progress: progress)}}@@ -144,6 +135,44 @@ public class Connection {}-public protocol ConnectionLookupHandler: Hashable {+private actor WeakPool<Key: Hashable, Value: AnyObject & Sendable, Failure: Error> {+ init() {}++ private var pendingValues: [Key: Task<Result<Value, Failure>, Never>] = [:]+ private var existingValues: [Key: Weak<Value>] = [:]++ func value(+ key: Key,+ create: @escaping @Sendable () async throws(Failure) -> Value+ ) async throws(Failure) -> Value {+ if let pending = pendingValues[key] {+ return try await pending.value.get()+ }++ if let existing = existingValues[key] {+ if let existingValue = existing.value {+ return existingValue+ } else {+ existingValues[key] = nil+ }+ }++ let task = Task { () -> Result<Value, Failure> in+ do throws(Failure) {+ let connection = try await create()+ existingValues[key] = Weak(connection)+ pendingValues[key] = nil+ return .success(connection)+ } catch {+ return .failure(error)+ }+ }+ pendingValues[key] = task++ return try await task.value.get()+ }+}++public protocol ConnectionLookupHandler: Hashable, Sendable {func createHandle() throws -> AnyObject}diff --git a/Sources/Supersign/Installation/Debugger.swift b/Sources/Supersign/Installation/Debugger.swiftindex 25024eb..97f4987 100644--- a/Sources/Supersign/Installation/Debugger.swift+++ b/Sources/Supersign/Installation/Debugger.swift@@ -9,11 +9,11 @@import Foundationimport SwiftyMobileDevice-public final class Debugger {+public actor Debugger {private let client: DebugserverClient- public init(connection: Connection) throws {- client = try connection.startClient()+ public init(connection: Connection) async throws {+ client = try await connection.startClient()try client.send(command: "QSetMaxPacketSize:", arguments: ["1024"])}@@ -23,21 +23,13 @@ public final class Debugger {// if the receiver is released before the completion handler is called, the// method will fail with `Debugger.Error.userCancelled`- public func attach(toProcess process: String, completion: @escaping (Result<(), Swift.Error>) -> Void) {- let queue = DispatchQueue(label: "debugger-attach-queue")- queue.async { [weak self] in- completion(Result {- var retainedSelf: Debugger?- var resp: Data- repeat {- retainedSelf = nil- guard let self = self else { throw Error.userCancelled }- retainedSelf = self- resp = try self.client.send(command: "vAttachWait;", arguments: [process])- } while resp.isEmpty- try retainedSelf!.client.send(command: "D", arguments: [])- })- }+ public func attach(toProcess process: String) async throws {+ var resp: Data+ repeat {+ try Task.checkCancellation()+ resp = try self.client.send(command: "vAttachWait;", arguments: [process])+ } while resp.isEmpty+ try self.client.send(command: "D", arguments: [])}}diff --git a/Sources/Supersign/Installation/HeartbeatHandler.swift b/Sources/Supersign/Installation/HeartbeatHandler.swiftindex 9c7f653..d4cd329 100644--- a/Sources/Supersign/Installation/HeartbeatHandler.swift+++ b/Sources/Supersign/Installation/HeartbeatHandler.swift@@ -8,8 +8,9 @@import Foundationimport SwiftyMobileDevice+import ConcurrencyExtras-public final class HeartbeatHandler {+public final class HeartbeatHandler: Sendable {private struct Error: Swift.Error {}private struct ReceivedPacket: Decodable {@@ -49,8 +50,7 @@ public final class HeartbeatHandler {private let heartbeatQueue = DispatchQueue(label: "com.kabiroberai.Supersign.heartbeat-queue")- private let stopLock = NSLock()- private var isStopped = false+ private let isStopped = LockIsolated(false)private let device: Deviceprivate let client: LockdownClient@@ -99,9 +99,7 @@ public final class HeartbeatHandler {guard let self = self else { break }do {- self.stopLock.lock()- defer { self.stopLock.unlock() }- guard !self.isStopped else { break }+ guard !self.isStopped.value else { break }}do {@@ -121,8 +119,6 @@ public final class HeartbeatHandler {}public func stop() {- stopLock.lock()- defer { stopLock.unlock() }- isStopped = true+ self.isStopped.setValue(true)}}diff --git a/Sources/Supersign/Installation/IPAInstaller.swift b/Sources/Supersign/Installation/IPAInstaller.swiftindex 62e6ffc..af2f4dd 100644--- a/Sources/Supersign/Installation/IPAInstaller.swift+++ b/Sources/Supersign/Installation/IPAInstaller.swift@@ -9,30 +9,21 @@import Foundationimport SwiftyMobileDevice-public final class IPAInstaller {+public final class IPAInstaller: Sendable {private let client: InstallationProxyClient- public init(connection: Connection) throws {- self.client = try connection.startClient()+ public init(connection: Connection) async throws {+ self.client = try await connection.startClient()}public func install(uploaded: IPAUploader.UploadedIPA,- progress: @escaping (InstallationProxyClient.RequestProgress) -> Void- ) throws {- var result: Result<(), Error>?- let semaphore = DispatchSemaphore(value: 0)- client.install(+ progress: @escaping @Sendable (InstallationProxyClient.RequestProgress) -> Void+ ) async throws {+ try await client.install(package: uploaded.location,- progress: progress,- completion: { res in- defer { semaphore.signal() }- result = res- }+ progress: progress)- semaphore.wait()-- try result!.get()}}diff --git a/Sources/Supersign/Installation/IPAUploader.swift b/Sources/Supersign/Installation/IPAUploader.swiftindex 4c5cbf2..1824d95 100644--- a/Sources/Supersign/Installation/IPAUploader.swift+++ b/Sources/Supersign/Installation/IPAUploader.swift@@ -9,7 +9,7 @@import Foundationimport SwiftyMobileDevice-public final class IPAUploader {+public final class IPAUploader: Sendable {public enum Error: Swift.Error {case unexpectedSymlink(at: URL)@@ -18,7 +18,7 @@ public final class IPAUploader {private static let packagePath = URL(fileURLWithPath: "PublicStaging")private static let bufferSize = 1 << 20 // 1 MB- public class UploadedIPA {+ public final class UploadedIPA: Sendable {public let uploader: IPAUploaderlet location: URLfileprivate init(uploader: IPAUploader, location: URL) {@@ -26,21 +26,19 @@ public final class IPAUploader {self.location = location}- public private(set) var isDeleted: Bool = false-deinit { delete() }+public func delete() {- guard !isDeleted else { return }try? uploader.client.removeItemAndContents(at: location)}}private let client: AFCClient- public init(connection: Connection) throws {- self.client = try connection.startClient()+ public init(connection: Connection) async throws {+ self.client = try await connection.startClient()}- private func upload(_ src: URL, to dest: URL, progress: (Double) -> Void) throws {+ private func upload(_ src: URL, to dest: URL, progress: (Double) -> Void) async throws {let srcData = try Data(contentsOf: src)let size = srcData.countlet sizeDouble = Double(size)@@ -50,6 +48,10 @@ public final class IPAUploader {var totalWritten = 0while totalWritten != size {+ if totalWritten != 0 {+ await Task.yield()+ try Task.checkCancellation()+ }let buf = srcData.dropFirst(totalWritten).prefix(bufferSize)let bufSize = buf.countvar bufWritten = 0@@ -63,7 +65,7 @@ public final class IPAUploader {}}- public func upload(app: URL, progress: (Double) -> Void) throws -> UploadedIPA {+ public func upload(app: URL, progress: (Double) -> Void) async throws -> UploadedIPA {if try !client.fileExists(at: Self.packagePath) {try client.createDirectory(at: Self.packagePath)}@@ -73,7 +75,7 @@ public final class IPAUploader {try client.removeItemAndContents(at: dest)}- try upload(app, to: dest, progress: progress)+ try await upload(app, to: dest, progress: progress)return UploadedIPA(uploader: self, location: dest)}diff --git a/Sources/Supersign/Installation/ProfileManager.swift b/Sources/Supersign/Installation/ProfileManager.swiftindex 33267c3..ca83479 100644--- a/Sources/Supersign/Installation/ProfileManager.swift+++ b/Sources/Supersign/Installation/ProfileManager.swift@@ -26,8 +26,8 @@ public final class ProfileManager {return minor >= 3}()- public init(connection: Connection) throws {- self.client = try connection.startClient()+ public init(connection: Connection) async throws {+ self.client = try await connection.startClient()self.version = try connection.client.value(ofType: String.self, forDomain: nil, key: "ProductVersion")}diff --git a/Sources/Supersign/Integration/SuperchargeInstaller.swift b/Sources/Supersign/Integration/SuperchargeInstaller.swiftindex 010c85e..77bd3f2 100644--- a/Sources/Supersign/Integration/SuperchargeInstaller.swift+++ b/Sources/Supersign/Integration/SuperchargeInstaller.swift@@ -15,13 +15,13 @@ extension LockdownClient {#if !os(iOS)-public protocol IntegratedInstallerDelegate: AnyObject {+public protocol IntegratedInstallerDelegate: AnyObject, Sendable {func fetchCode() async -> String?- func fetchTeam(fromTeams teams: [DeveloperServicesTeam], completion: @escaping (DeveloperServicesTeam?) -> Void)+ func fetchTeam(fromTeams teams: [DeveloperServicesTeam]) async -> DeveloperServicesTeam?+func setPresentedMessage(_ message: IntegratedInstaller.Message?)func installerDidUpdate(toStage stage: String, progress: Double?)- func installerDidComplete(withResult result: Result<String, Error>)// defaults to always returning truefunc confirmRevocation(of certificates: [DeveloperServicesCertificate]) async -> Bool@@ -32,14 +32,11 @@ public protocol IntegratedInstallerDelegate: AnyObject {/// - Parameter directory: The directory into which `ipa` should be decompressed./// - Parameter progress: A closure to which the callee can provide progress updates./// - Parameter currentProgress: The current progress, or `nil` to indicate it is indeterminate.- /// - Parameter completion: A completion handler to call once decompression is finished.- /// - Parameter success: Whether or not extraction was successful.func decompress(ipa: URL,in directory: URL,- progress: @escaping (_ currentProgress: Double?) -> Void,- completion: @escaping (_ success: Bool) -> Void- )+ progress: @escaping @Sendable (_ currentProgress: Double?) -> Void+ ) async throws// `compress` is required because the only way to upload symlinks via afc is by// putting them in a zip archive (afc_make_symlink was disabled due to security or@@ -50,14 +47,10 @@ public protocol IntegratedInstallerDelegate: AnyObject {/// - Parameter payloadDir: The `Payload` directory which is to be compressed./// - Parameter progress: A closure to which the callee can provide progress updates./// - Parameter currentProgress: The current progress, or `nil` to indicate it is indeterminate.- /// - Parameter completion: A completion handler to call with the compressed file's URL.- /// - Parameter result: A result with the URL of the compressed file. The caller is responsible- /// for cleaning this up once installation is complete.func compress(payloadDir: URL,- progress: @escaping (_ currentProgress: Double?) -> Void,- completion: @escaping (_ result: Result<URL, Error>) -> Void- )+ progress: @escaping @Sendable (_ currentProgress: Double?) -> Void+ ) async throws -> URL}@@ -67,13 +60,12 @@ extension IntegratedInstallerDelegate {}}-public final class IntegratedInstaller {+public actor IntegratedInstaller {public enum Error: LocalizedError {case alreadyInstallingcase deviceInfoFetchFailedcase noTeamFound- case userCancelledcase appExtractionFailedcase appCorruptedcase appPackagingFailed@@ -89,7 +81,7 @@ public final class IntegratedInstaller {case unlockDevice}- public enum Credentials {+ public enum Credentials: Sendable {case password(String)case token(DeveloperServicesLoginToken)}@@ -106,56 +98,51 @@ public final class IntegratedInstaller {private let tempDir = FileManager.default.temporaryDirectoryShim.appendingPathComponent("com.kabiroberai.Supercharge-Installer.Staging")- private let installQueue =- DispatchQueue(label: "com.kabiroberai.Supercharge-Installer.install-queue", qos: .userInitiated, attributes: [])- private enum ExecutionState {- case running- case complete+ private var stage: String?++ private func updateStage(+ to stage: String,+ initialProgress: Double? = 0+ ) async throws {+ await Task.yield()+ try Task.checkCancellation()+ updateStageIgnoringCancellation(to: stage, initialProgress: initialProgress)}- private var executionStateLock = NSLock()- private var executionState: ExecutionState = .running-- private func shouldContinue() -> Bool {- executionStateLock.lock()- defer { executionStateLock.unlock() }- switch executionState {- case .running:- return true- case .complete:- return false- }+ private func updateStage(+ to stage: String,+ initialProgress: Double? = 0+ ) throws {+ try Task.checkCancellation()+ updateStageIgnoringCancellation(to: stage, initialProgress: initialProgress)}- private func completion(_ result: Result<String, Swift.Error>) {- executionStateLock.lock()- defer { executionStateLock.unlock() }- guard executionState != .complete else { return }- try? FileManager.default.removeItem(at: tempDir)- executionState = .complete- delegate?.installerDidComplete(withResult: result)- delegate = nil+ private func updateStageIgnoringCancellation(+ to stage: String,+ initialProgress: Double? = 0+ ) {+ guard self.stage != stage else { return }+ self.stage = stage+ delegate?.installerDidUpdate(toStage: stage, progress: initialProgress)}- public func cancel() {- completion(.failure(Error.userCancelled))+ private func updateProgress(to progress: Double?) async throws {+ await Task.yield()+ try Task.checkCancellation()+ updateProgressIgnoringCancellation(to: progress)}- private var stage: String?- private func updateStage(to stage: String, initialProgress: Double? = 0, ignoreCancellation: Bool = false) -> Bool {- guard ignoreCancellation || shouldContinue(), self.stage != stage else { return false }- self.stage = stage- delegate?.installerDidUpdate(toStage: stage, progress: initialProgress)- return true+ private func updateProgress(to progress: Double?) throws {+ try Task.checkCancellation()+ updateProgressIgnoringCancellation(to: progress)}- private func updateProgress(to progress: Double?, ignoreCancellation: Bool = false) -> Bool {- guard ignoreCancellation || shouldContinue() else { return false }++ private func updateProgressIgnoringCancellation(to progress: Double?) {guard let stage = stage else {preconditionFailure("Cannot change progress without setting stage at least once")}delegate?.installerDidUpdate(toStage: stage, progress: progress)- return true}public init(@@ -176,7 +163,10 @@ public final class IntegratedInstaller {self.delegate = delegate}- private func performWithRecovery<T>(repeatAfter: TimeInterval = 0.1, block: () throws -> T) throws -> T {+ private func performWithRecovery<T>(+ repeatAfter: TimeInterval = 0.1,+ block: () async throws -> sending T+ ) async throws -> sending T {var currMessage: Message?defer {@@ -186,10 +176,9 @@ public final class IntegratedInstaller {}while true {- guard shouldContinue() else { throw Error.userCancelled }let nextMessage: Messagedo {- return try block()+ return try await block()} catch let error as LockdownClient.Error where error == .pairingDialogResponsePending {nextMessage = .pairDevice} catch let error as LockdownClient.Error where error == .passwordProtected {@@ -199,24 +188,22 @@ public final class IntegratedInstaller {delegate?.setPresentedMessage(nextMessage)currMessage = nextMessage}- if repeatAfter > 0 {- Thread.sleep(forTimeInterval: repeatAfter)- }+ try await Task.sleep(nanoseconds: UInt64(repeatAfter * 1_000_000_000))}}// returns nil for pairingKeys if !configureDevice// returns nil overall if cancelled- private func prepareDevice() throws -> (deviceName: String, pairingKeys: Data?)? {+ private func prepareDevice() async throws -> (deviceName: String, pairingKeys: Data?) {// TODO: Maybe use `Connection` here instead of creating the lockdown// client manually?let device = try Device(udid: udid, lookupMode: lookupMode)- guard updateProgress(to: 1/3) else { return nil }+ try await updateProgress(to: 1/3)// we can't reuse any previously created client because we need to perform a handshake this time- let lockdownClient = try performWithRecovery {+ let lockdownClient = try await performWithRecovery {try LockdownClient(device: device,label: LockdownClient.installerLabel,@@ -227,14 +214,14 @@ public final class IntegratedInstaller {let deviceName = try lockdownClient.deviceName()if !configureDevice {- guard updateProgress(to: 1) else { return nil }+ try await updateProgress(to: 1)return (deviceName, nil)}try lockdownClient.setValue(udid, forDomain: "com.apple.mobile.wireless_lockdown", key: "WirelessBuddyID")try lockdownClient.setValue(true, forDomain: "com.apple.mobile.wireless_lockdown", key: "EnableWifiConnections")- guard updateProgress(to: 2/3) else { return nil }+ try await updateProgress(to: 2/3)// now create a new pair record based off the existing one, but replacing the// SystemBUID and HostID. This is necessary because if two machines with the@@ -273,7 +260,7 @@ public final class IntegratedInstaller {hostID: hostID,systemBUID: newSystemBUID)- try performWithRecovery {+ try await performWithRecovery {try lockdownClient.pair(withRecord: record)}@@ -281,7 +268,7 @@ public final class IntegratedInstaller {fromPropertyList: plist, format: plistFormat, options: 0)- guard updateProgress(to: 1) else { return nil }+ try await updateProgress(to: 1)return (deviceName, data)}@@ -293,19 +280,19 @@ public final class IntegratedInstaller {team: DeveloperServicesTeam,ipa: URL,bundleID: String- ) {- guard shouldContinue() else { return }- executionStateLock.lock()- defer { executionStateLock.unlock() }+ ) async throws -> String {+ try Task.checkCancellation()let appInstaller = AppInstaller(ipa: ipa, udid: udid, connectionPreferences: .init(lookupMode: lookupMode))self.appInstaller = appInstaller- appInstaller.install(+ try await appInstaller.install(progress: { stage in- _ = self.updateStage(to: stage.displayName, ignoreCancellation: true)- _ = self.updateProgress(to: stage.displayProgress, ignoreCancellation: true)- },- completion: { self.completion($0.map { bundleID }) }+ Task {+ await self.updateStageIgnoringCancellation(to: stage.displayName)+ await self.updateProgressIgnoringCancellation(to: stage.displayProgress)+ }+ })+ return bundleID}private func packageAndInstall(@@ -315,30 +302,28 @@ public final class IntegratedInstaller {team: DeveloperServicesTeam,appDir: URL,bundleID: String- ) {- guard self.updateStage(to: "Packaging", initialProgress: nil)- else { return }+ ) async throws -> String {+ try await self.updateStage(to: "Packaging", initialProgress: nil)- delegate?.compress(+ let ipa = try await delegate?.compress(payloadDir: appDir.deletingLastPathComponent(),progress: { progress in- _ = self.updateProgress(to: progress, ignoreCancellation: true)- },- completion: { result in- guard self.updateProgress(to: 1) else { return self.completion(.failure(Error.userCancelled)) }- guard let ipa = result.get(withErrorHandler: self.completion) else { return }- self.installQueue.async {- self.install(- deviceInfo: deviceInfo,- token: token,- client: client,- team: team,- ipa: ipa,- bundleID: bundleID- )+ Task {+ await self.updateProgressIgnoringCancellation(to: progress)}})++ try await self.updateProgress(to: 1)++ return try await self.install(+ deviceInfo: deviceInfo,+ token: token,+ client: client,+ team: team,+ ipa: ipa!,+ bundleID: bundleID+ )}private func install(@@ -348,46 +333,36 @@ public final class IntegratedInstaller {client: DeveloperServicesClient,team: DeveloperServicesTeam,appDir: URL- ) {- guard self.updateStage(to: "Preparing device") else { return }-- let deviceName: String- let pairingKeys: Data?-- do {- guard let prepareResult = try prepareDevice()- else { return } // nil: user cancelled- (deviceName, pairingKeys) = prepareResult- } catch {- return completion(.failure(error))- }+ ) async throws -> String {+ try await self.updateStage(to: "Preparing device")++ let (deviceName, pairingKeys) = try await prepareDevice()++ let context = try SigningContext(+ udid: udid,+ deviceName: deviceName,+ teamID: team.id,+ client: client,+ signingInfoManager: KeyValueSigningInfoManager(storage: storage),+ platform: .iOS+ )- let context: SigningContext- do {- context = try SigningContext(- udid: udid,- deviceName: deviceName,- teamID: team.id,- client: client,- signingInfoManager: KeyValueSigningInfoManager(storage: storage),- platform: .iOS- )- } catch {- return completion(.failure(error))- }let signer = Signer(context: context) { certs in- guard let delegate = self.delegate else { return false }- return await delegate.confirmRevocation(of: certs)+ await self.delegate?.confirmRevocation(of: certs) ?? false}- signer.sign(+ let bundleID = try await signer.sign(app: appDir,- status: { status in- _ = self.updateStage(to: status, ignoreCancellation: true)+ status: { @Sendable status in+ Task {+ await self.updateStageIgnoringCancellation(to: status)+ }},progress: { progress in- _ = self.updateProgress(to: progress, ignoreCancellation: true)+ Task {+ _ = await self.updateProgressIgnoringCancellation(to: progress)+ }},- didProvision: {+ didProvision: { @Sendable inif let pairingKeys = pairingKeys {let info = try context.signingInfoManager.info(forTeamID: context.teamID)try Superconfig(@@ -401,19 +376,16 @@ public final class IntegratedInstaller {token: token).save(inAppDir: appDir)}- },- completion: { result in- guard let bundleID = result.get(withErrorHandler: self.completion) else { return }- self.packageAndInstall(- deviceInfo: deviceInfo,- token: token,- client: client,- team: team,- appDir: appDir,- bundleID: bundleID- )})+ return try await self.packageAndInstall(+ deviceInfo: deviceInfo,+ token: token,+ client: client,+ team: team,+ appDir: appDir,+ bundleID: bundleID+ )}private func install(@@ -422,126 +394,105 @@ public final class IntegratedInstaller {token: DeveloperServicesLoginToken,anisetteProvider: AnisetteDataProvider,appDir: URL- ) {+ ) async throws -> String {let client = DeveloperServicesClient(loginToken: token,deviceInfo: deviceInfo,anisetteProvider: anisetteProvider)- client.send(DeveloperServicesListTeamsRequest()) { result in- guard let teams = result.get(withErrorHandler: self.completion) else { return }- guard self.updateProgress(to: 1) else { return }- switch teams.count {- case 0:- return self.completion(.failure(Error.noTeamFound))- case 1:- self.install(deviceInfo: deviceInfo, provisioningData: provisioningData, token: token, client: client, team: teams[0], appDir: appDir)- default:- self.delegate?.fetchTeam(fromTeams: teams) { team in- self.installQueue.async {- guard let team = team else { return self.completion(.failure(Error.userCancelled)) }- self.install(deviceInfo: deviceInfo, provisioningData: provisioningData, token: token, client: client, team: team, appDir: appDir)- }- }- }+ let teams = try await client.send(DeveloperServicesListTeamsRequest())+ try await self.updateProgress(to: 1)+ let team: DeveloperServicesTeam+ switch teams.count {+ case 0:+ throw Error.noTeamFound+ case 1:+ team = teams[0]+ default:+ guard let selectedTeam = await self.delegate?.fetchTeam(fromTeams: teams)+ else { throw CancellationError() }+ team = selectedTeam}+ return try await self.install(+ deviceInfo: deviceInfo,+ provisioningData: provisioningData,+ token: token,+ client: client,+ team: team,+ appDir: appDir+ )}- private func install(decompressionDidSucceed: Bool) {+ private func installAfterDecompression() async throws -> String {let payload = self.tempDir.appendingPathComponent("Payload")- guard decompressionDidSucceed,- let appDir = payload.implicitContents.first(where: { $0.pathExtension == "app" })- else { return self.completion(.failure(Error.appExtractionFailed)) }+ guard let appDir = payload.implicitContents.first(where: { $0.pathExtension == "app" })+ else { throw Error.appExtractionFailed }guard let deviceInfo = DeviceInfo.current() else {- return completion(.failure(Error.deviceInfoFetchFailed))+ throw Error.deviceInfoFetchFailed}- guard updateStage(to: "Logging in") else { return }-- do {- let anisetteProvider = try ADIDataProvider.adiProvider(deviceInfo: deviceInfo, storage: storage)- switch credentials {- case .password(let password):- try DeveloperServicesLoginManager(- deviceInfo: deviceInfo,- anisetteProvider: anisetteProvider- ).logIn(- withUsername: self.appleID,- password: password,- twoFactorDelegate: self- ) { result in- guard let token = result.get(withErrorHandler: self.completion) else { return }- guard self.updateProgress(to: 1/2) else { return }- self.install(- deviceInfo: deviceInfo,- provisioningData: anisetteProvider.provisioningData(),- token: token,- anisetteProvider: anisetteProvider,- appDir: appDir- )- }- case .token(let token):- self.install(- deviceInfo: deviceInfo,- provisioningData: anisetteProvider.provisioningData(),- token: token,- anisetteProvider: anisetteProvider,- appDir: appDir- )- }- } catch {- return completion(.failure(error))+ try await updateStage(to: "Logging in")++ let anisetteProvider = try ADIDataProvider.adiProvider(deviceInfo: deviceInfo, storage: storage)+ let token: DeveloperServicesLoginToken+ switch credentials {+ case .password(let password):+ let newToken = try await DeveloperServicesLoginManager(+ deviceInfo: deviceInfo,+ anisetteProvider: anisetteProvider+ ).logIn(+ withUsername: self.appleID,+ password: password,+ twoFactorDelegate: self+ )+ try await self.updateProgress(to: 1/2)+ token = newToken+ case .token(let existingToken):+ token = existingToken}+ return try await self.install(+ deviceInfo: deviceInfo,+ provisioningData: anisetteProvider.provisioningData(),+ token: token,+ anisetteProvider: anisetteProvider,+ appDir: appDir+ )}- private func installOnQueue(app: URL) {- guard self.updateStage(to: "Unpacking app", initialProgress: nil) else { return }+ @discardableResult+ public func install(app: URL) async throws -> String {+ try await self.updateStage(to: "Unpacking app", initialProgress: nil)if FileManager.default.fileExists(atPath: tempDir.path) {try? FileManager.default.removeItem(at: tempDir)}- do {- try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true)- } catch {- return completion(.failure(error))- }+ try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: tempDir) }switch app.pathExtension {case "ipa":- delegate?.decompress(+ try await delegate?.decompress(ipa: app,in: tempDir,progress: { progress in- _ = self.updateProgress(to: progress, ignoreCancellation: true)- },- completion: { success in- guard self.updateProgress(to: 1) else { return self.completion(.failure(Error.userCancelled)) }- self.installQueue.async {- self.install(decompressionDidSucceed: success)+ Task {+ await self.updateProgressIgnoringCancellation(to: progress)}})+ try await self.updateProgress(to: 1)+ return try await self.installAfterDecompression()case "app":let payload = tempDir.appendingPathComponent("Payload")let dest = payload.appendingPathComponent(app.lastPathComponent)- do {- try FileManager.default.createDirectory(at: payload, withIntermediateDirectories: false)- try FileManager.default.copyItem(at: app, to: dest)- } catch {- return completion(.failure(error))- }- guard self.updateProgress(to: 1) else { return self.completion(.failure(Error.userCancelled)) }- self.install(decompressionDidSucceed: true)+ try FileManager.default.createDirectory(at: payload, withIntermediateDirectories: false)+ try FileManager.default.copyItem(at: app, to: dest)+ try await self.updateProgress(to: 1)+ return try await self.installAfterDecompression()default:- return completion(.failure(Error.appExtractionFailed))- }- }-- public func install(app: URL) {- installQueue.async {- self.installOnQueue(app: app)+ throw Error.appExtractionFailed}}diff --git a/Sources/Supersign/Model/Certificate/Certificate.swift b/Sources/Supersign/Model/Certificate/Certificate.swiftindex c5d9e3e..0a3e690 100644--- a/Sources/Supersign/Model/Certificate/Certificate.swift+++ b/Sources/Supersign/Model/Certificate/Certificate.swift@@ -11,7 +11,7 @@ import X509import SwiftASN1/// A certificate in DER format-public struct Certificate: Codable {+public struct Certificate: Codable, Sendable {public enum Error: Swift.Error {case invalidCertificatediff --git a/Sources/Supersign/Model/Entitlements/Entitlement.swift b/Sources/Supersign/Model/Entitlements/Entitlement.swiftindex d2b695e..2f695a7 100644--- a/Sources/Supersign/Model/Entitlements/Entitlement.swift+++ b/Sources/Supersign/Model/Entitlements/Entitlement.swift@@ -9,7 +9,7 @@import Foundationimport ProtoCodable-public protocol Entitlement: ProtoCodable {+public protocol Entitlement: ProtoCodable, Sendable {static var identifier: String { get }static var isFree: Bool { get }/// whether this entitlement should be included in developer services API requestsdiff --git a/Sources/Supersign/Model/Entitlements/Entitlements.swift b/Sources/Supersign/Model/Entitlements/Entitlements.swiftindex b654ef6..6ebb00a 100644--- a/Sources/Supersign/Model/Entitlements/Entitlements.swift+++ b/Sources/Supersign/Model/Entitlements/Entitlements.swift@@ -10,13 +10,13 @@ import Foundationimport ProtoCodableimport Superutils-public struct EntitlementContainer: ProtoCodableContainer {+public struct EntitlementContainer: ProtoCodableContainer, Sendable {public var value: Entitlementpublic init(value: Entitlement) { self.value = value }}// allows access to a parsable entitlements list while not losing unparsed entitlements when it's modified-public struct Entitlements {+public struct Entitlements: Sendable {private static let decoder = PropertyListDecoder()private static let encoder = PropertyListEncoder()diff --git a/Sources/Supersign/Model/Keypair/Keypair.swift b/Sources/Supersign/Model/Keypair/Keypair.swiftindex 6131cc6..13deacb 100644--- a/Sources/Supersign/Model/Keypair/Keypair.swift+++ b/Sources/Supersign/Model/Keypair/Keypair.swift@@ -11,7 +11,7 @@ import Cryptoimport X509import _CryptoExtras-public struct PrivateKey: Codable {+public struct PrivateKey: Codable, Sendable {// pem encodedpublic let data: Data@@ -20,7 +20,7 @@ public struct PrivateKey: Codable {}}-public struct CSR {+public struct CSR: Sendable {public let pemString: Stringpublic init(pemString: String) {diff --git a/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift b/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swiftindex 61a037b..c68e9c4 100644--- a/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift+++ b/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift@@ -9,7 +9,7 @@import Foundationimport CSupersign-public final class Mobileprovision: Decodable {+public final class Mobileprovision: Decodable, @unchecked Sendable {public enum Error: Swift.Error {case invalidProfilediff --git a/Sources/Supersign/Signer/Signer.swift b/Sources/Supersign/Signer/Signer.swiftindex 2f30be2..f5a4425 100644--- a/Sources/Supersign/Signer/Signer.swift+++ b/Sources/Supersign/Signer/Signer.swift@@ -40,10 +40,10 @@ public struct Signer {}public let context: SigningContext- public let confirmRevocation: ([DeveloperServicesCertificate]) async -> Bool+ public let confirmRevocation: @Sendable ([DeveloperServicesCertificate]) async -> Boolpublic init(context: SigningContext,- confirmRevocation: @escaping ([DeveloperServicesCertificate]) async -> Bool+ confirmRevocation: @escaping @Sendable ([DeveloperServicesCertificate]) async -> Bool) {self.context = contextself.confirmRevocation = confirmRevocation@@ -52,7 +52,7 @@ public struct Signer {public func sign(app: URL,status: @escaping (String) -> Void,- progress: @escaping (Double?) -> Void,+ progress: @escaping @Sendable (Double?) -> Void,didProvision: @escaping () throws -> Void = {}) async throws -> String {status(NSLocalizedString("signer.provisioning", value: "Provisioning", comment: ""))@@ -103,18 +103,4 @@ public struct Signer {return mainInfo.newBundleID}- public func sign(- app: URL,- status: @escaping (String) -> Void,- progress: @escaping (Double?) -> Void,- didProvision: @escaping () throws -> Void = {},- completion: @escaping (Result<String, Swift.Error>) -> Void- ) {- Task {- completion(await Result { try await sign(- app: app, status: status, progress: progress, didProvision: didProvision)- })- }- }-}diff --git a/Sources/Supersign/Signer/SignerImpl.swift b/Sources/Supersign/Signer/SignerImpl.swiftindex 259cacf..9fe13a4 100644--- a/Sources/Supersign/Signer/SignerImpl.swift+++ b/Sources/Supersign/Signer/SignerImpl.swift@@ -9,9 +9,10 @@import Foundationimport CSupersignimport SignerSupport+import ConcurrencyExtras/// a wrapper around signer_t-public struct SignerImpl {+public actor SignerImpl {private static let signingQueue = DispatchQueue(label: "com.kabiroberai.Supercharge.signing-queue",@@ -48,18 +49,18 @@ public struct SignerImpl {String(cString: signer.pointee.name)}- private init(signer: UnsafePointer<signer_t>) {- self.signer = signer+ private init(signer: UncheckedSendable<UnsafePointer<signer_t>>) {+ self.signer = signer.value}- public static func all() -> AnyCollection<SignerImpl> {+ public static func all() -> some Collection<SignerImpl> {var list = get_signers()var arr: [SignerImpl] = []while let curr = list {- arr.append(SignerImpl(signer: curr))+ arr.append(SignerImpl(signer: UncheckedSendable(curr)))list = curr.pointee.next}- return AnyCollection(arr)+ return arr}public static func first() throws -> SignerImpl {@@ -96,11 +97,18 @@ public struct SignerImpl {$0.data.deallocate()}}+ let sendableProgress = UncheckedSendable(progress)+ let sendableEntsArray = UncheckedSendable(entsArray)try certificate.data().withUnsafeBytes { cert in+ let sendableCert = UncheckedSendable(cert)try privateKey.data.withUnsafeBytes { priv invar exception: UnsafeMutablePointer<Int8>?defer { exception.map { free($0) } }+ let progress = sendableProgress.value+ let cert = sendableCert.value+ let entsArray = sendableEntsArray.value+guard let certBase = cert.baseAddress,let privBase = priv.baseAddresselse { throw Error.signer(nil) }@@ -137,22 +145,13 @@ public struct SignerImpl {entitlementMapping: [URL: Entitlements],progress: @escaping (Double?) -> Void) async throws {- try await withCheckedThrowingContinuation { cont in- Self.signingQueue.async {- do {- try self._sign(- app: app,- certificate: certificate,- privateKey: privateKey,- entitlementMapping: entitlementMapping,- progress: progress- )- cont.resume()- } catch {- cont.resume(throwing: error)- }- }- }+ try self._sign(+ app: app,+ certificate: certificate,+ privateKey: privateKey,+ entitlementMapping: entitlementMapping,+ progress: progress+ )}public func analyze(executable: URL) throws -> Data {@@ -160,8 +159,10 @@ public struct SignerImpl {guard let path = path else { throw Error.badFilePath }var exception: UnsafeMutablePointer<Int8>?defer { exception.map { free($0) } }- return try Data { signer.pointee.analyze(path, &$0, &exception) }- .orThrow(Error.signer(exception.map { String(cString: $0) }))+ var count = 0+ guard let bytes = signer.pointee.analyze(path, &count, &exception)+ else { throw Error.signer(exception.map { String(cString: $0) })}+ return Data(bytesNoCopy: bytes, count: count, deallocator: .free)}}diff --git a/Sources/Supersign/Signer/SigningContext.swift b/Sources/Supersign/Signer/SigningContext.swiftindex 6694243..76cfde3 100644--- a/Sources/Supersign/Signer/SigningContext.swift+++ b/Sources/Supersign/Signer/SigningContext.swift@@ -8,7 +8,7 @@import Foundation-public struct SigningContext {+public struct SigningContext: Sendable {public let udid: Stringpublic let deviceName: Stringdiff --git a/Sources/Supersign/Utilities/CHelpers.swift b/Sources/Supersign/Utilities/CHelpers.swiftindex e6ac0f6..4cd87a1 100644--- a/Sources/Supersign/Utilities/CHelpers.swift+++ b/Sources/Supersign/Utilities/CHelpers.swift@@ -7,6 +7,11 @@//import Foundation+import CSupersign++package var stdoutSafe: UnsafeMutablePointer<FILE> {+ get_stdout()+}extension Data {init?(deallocator: Deallocator = .free, acceptor: (inout Int) -> UnsafeMutableRawPointer?) {diff --git a/Sources/Supersign/Utilities/KeyValueStorage.swift b/Sources/Supersign/Utilities/KeyValueStorage.swiftindex cbd95e8..c3d2717 100644--- a/Sources/Supersign/Utilities/KeyValueStorage.swift+++ b/Sources/Supersign/Utilities/KeyValueStorage.swift@@ -7,12 +7,13 @@//import Foundation+import ConcurrencyExtraspublic enum KeyValueStorageError: Error {case stringConversionFailure}-public protocol KeyValueStorage {+public protocol KeyValueStorage: Sendable {func data(forKey key: String) throws -> Data?func setData(_ data: Data?, forKey key: String) throws// default implementations provided@@ -43,9 +44,9 @@ extension KeyValueStorage {}}-public class MemoryKeyValueStorage: KeyValueStorage {+public final class MemoryKeyValueStorage: KeyValueStorage {- private var dict: [String: Data] = [:]+ private let dict = LockIsolated<[String: Data]>([:])public init() {}public func data(forKey key: String) throws -> Data? {@@ -53,7 +54,7 @@ public class MemoryKeyValueStorage: KeyValueStorage {}public func setData(_ data: Data?, forKey key: String) throws {- dict[key] = data+ dict.withValue { $0[key] = data }}}diff --git a/Sources/Supersign/Utilities/RequestGrouper.swift b/Sources/Supersign/Utilities/RequestGrouper.swiftindex c066085..4a2439f 100644--- a/Sources/Supersign/Utilities/RequestGrouper.swift+++ b/Sources/Supersign/Utilities/RequestGrouper.swift@@ -20,38 +20,3 @@ public struct ErrorList<E: Error>: LocalizedError {}}--class RequestGrouper<T, E: Error> {-- private let waitQueue = DispatchQueue(- label: "com.kabiroberai.Supersign.request-wait-queue",- attributes: .concurrent- )- private let group = DispatchGroup()-- private var values: [T] = []- private var errors: [E] = []-- func add(request: (_ completion: @escaping (Result<T, E>) -> Void) -> Void) {- group.enter()- request { result in- defer { self.group.leave() }- switch result {- case .failure(let error): self.errors.append(error)- case .success(let value): self.values.append(value)- }- }- }-- func onComplete(_ completion: @escaping (Result<[T], Error>) -> Void) {- waitQueue.async {- self.group.wait()- switch self.errors.count {- case 0: completion(.success(self.values))- case 1: completion(.failure(self.errors[0]))- default: completion(.failure(ErrorList(self.errors)))- }- }- }--}diff --git a/Sources/Supersign/Utilities/SigningInfo.swift b/Sources/Supersign/Utilities/SigningInfo.swiftindex b266a31..61ed034 100644--- a/Sources/Supersign/Utilities/SigningInfo.swift+++ b/Sources/Supersign/Utilities/SigningInfo.swift@@ -7,13 +7,14 @@//import Foundation+import ConcurrencyExtras-public struct SigningInfo: Codable {+public struct SigningInfo: Codable, Sendable {public let privateKey: PrivateKeypublic let certificate: Certificate}-public protocol SigningInfoManager {+public protocol SigningInfoManager: Sendable {func info(forTeamID teamID: DeveloperServicesTeam.ID) throws -> SigningInfo?func setInfo(_ info: SigningInfo?, forTeamID teamID: DeveloperServicesTeam.ID) throws}@@ -29,8 +30,8 @@ extension SigningInfoManager {}}-public class MemoryBackedSigningInfoManager: SigningInfoManager {- private var infos: [String: SigningInfo] = [:]+public final class MemoryBackedSigningInfoManager: SigningInfoManager {+ private let infos = LockIsolated<[String: SigningInfo]>([:])public init() {}@@ -39,7 +40,9 @@ public class MemoryBackedSigningInfoManager: SigningInfoManager {}public func setInfo(_ info: SigningInfo?, forTeamID teamID: DeveloperServicesTeam.ID) throws {- infos[teamID.rawValue] = info+ infos.withValue {+ $0[teamID.rawValue] = info+ }}}diff --git a/Sources/SupersignCLISupport/Console.swift b/Sources/SupersignCLISupport/Console.swiftindex 66ecb67..8de98ba 100644--- a/Sources/SupersignCLISupport/Console.swift+++ b/Sources/SupersignCLISupport/Console.swift@@ -1,4 +1,5 @@import Foundation+import Supersignenum Console {// nil = EOF@@ -6,7 +7,7 @@ enum Console {if !message.isEmpty {print(message, terminator: "")}- fflush(stdout)+ fflush(stdoutSafe)return readLine()}diff --git a/Sources/SupersignCLISupport/DSCommand.swift b/Sources/SupersignCLISupport/DSCommand.swiftindex 6b9426f..4811d89 100644--- a/Sources/SupersignCLISupport/DSCommand.swift+++ b/Sources/SupersignCLISupport/DSCommand.swift@@ -30,7 +30,7 @@ private extension AuthToken {storage: SupersignCLI.config.storage)if resetProvisioning {- await provider.resetProvisioning()+ provider.resetProvisioning()}let authDelegate = SupersignCLIAuthDelegate()let manager = try DeveloperServicesLoginManager(@@ -120,7 +120,7 @@ struct DSTeamsListCommand: AsyncParsableCommand {}struct DSAnisetteCommand: AsyncParsableCommand {- private class Provider: RawADIProvider, RawADIProvisioningSession {+ private final class Provider: RawADIProvider, RawADIProvisioningSession {func startProvisioning(spim: Data, userID: UUID) -> (RawADIProvisioningSession, Data) {print("spim: \(spim.base64EncodedString())")return (self, Data(base64Encoded: Console.prompt("cpim: ")!)!)diff --git a/Sources/SupersignCLISupport/DevicesCommand.swift b/Sources/SupersignCLISupport/DevicesCommand.swiftindex 84c2b48..dbb53d4 100644--- a/Sources/SupersignCLISupport/DevicesCommand.swift+++ b/Sources/SupersignCLISupport/DevicesCommand.swift@@ -2,7 +2,7 @@ import Foundationimport Supersignimport ArgumentParser-extension ConnectionManager.SearchMode: @retroactive EnumerableFlag {+extension ConnectionManager.SearchMode: EnumerableFlag {// public static func name(for value: ConnectionManager.SearchMode) -> NameSpecification {// [.short, .long]// }diff --git a/Sources/SupersignCLISupport/InstallCommand.swift b/Sources/SupersignCLISupport/InstallCommand.swiftindex 2def7cd..a234481 100644--- a/Sources/SupersignCLISupport/InstallCommand.swift+++ b/Sources/SupersignCLISupport/InstallCommand.swift@@ -3,7 +3,7 @@ import Supersignimport SwiftyMobileDeviceimport ArgumentParser-struct InstallCommand: ParsableCommand {+struct InstallCommand: AsyncParsableCommand {static let configuration = CommandConfiguration(commandName: "install",abstract: "Install an ipa file to your device"@@ -20,7 +20,7 @@ struct InstallCommand: ParsableCommand {help: "The path to a custom app/ipa to install") var path: String- func run() throws {+ func run() async throws {let token = try account.flatMap(AuthToken.init(string:)) ?? AuthToken.saved()let username = token.appleID@@ -28,10 +28,7 @@ struct InstallCommand: ParsableCommand {print("Installing to device: \(client.deviceName) (udid: \(client.udid))")- let semaphore = DispatchSemaphore(value: 0)- let installDelegate = SupersignCLIDelegate(preferredTeam: team.map(DeveloperServicesTeam.ID.init)) {- semaphore.signal()- }+ let installDelegate = SupersignCLIDelegate(preferredTeam: team.map(DeveloperServicesTeam.ID.init))let installer = IntegratedInstaller(udid: client.udid,lookupMode: .only(client.connectionType),@@ -41,8 +38,13 @@ struct InstallCommand: ParsableCommand {storage: SupersignCLI.config.storage,delegate: installDelegate)- installer.install(app: URL(fileURLWithPath: path))- semaphore.wait()- _ = installer++ do {+ try await installer.install(app: URL(fileURLWithPath: path))+ print("\nSuccessfully installed!")+ } catch {+ print("\nFailed :(")+ print("Error: \(error)")+ }}}diff --git a/Sources/SupersignCLISupport/SuperchargeCommand.swift b/Sources/SupersignCLISupport/SuperchargeCommand.swiftindex 123609f..c6f66cc 100644--- a/Sources/SupersignCLISupport/SuperchargeCommand.swift+++ b/Sources/SupersignCLISupport/SuperchargeCommand.swift@@ -2,7 +2,7 @@ import Foundationimport Supersignimport ArgumentParser-struct InstallSuperchargeCommand: ParsableCommand {+struct InstallSuperchargeCommand: AsyncParsableCommand {static let configuration = CommandConfiguration(commandName: "install",abstract: "Install Supercharge"@@ -11,7 +11,7 @@ struct InstallSuperchargeCommand: ParsableCommand {@Option(name: .shortAndLong) var udid: String?@Option(name: .shortAndLong) var account: String?- func run() throws {+ func run() async throws {guard let app = SupersignCLI.config.superchargeApp else {throw Console.Error("This copy of Supersign is not configured to install Supercharge.")}@@ -58,9 +58,7 @@ struct InstallSuperchargeCommand: ParsableCommand {print("Installing to device: \(client.deviceName) (udid: \(client.udid))")- let installDelegate = SupersignCLIDelegate(preferredTeam: nil) {- semaphore.signal()- }+ let installDelegate = SupersignCLIDelegate(preferredTeam: nil)let installer = IntegratedInstaller(udid: client.udid,lookupMode: .only(.usb),@@ -70,9 +68,22 @@ struct InstallSuperchargeCommand: ParsableCommand {storage: SupersignCLI.config.storage,delegate: installDelegate)- installer.install(app: app)- semaphore.wait()- _ = installer++ do {+ let bundleID = try await installer.install(app: app)+ print("\nSuccessfully installed!")+ if let file = ProcessInfo.processInfo.environment["SUPERSIGN_METADATA_FILE"] {+ do {+ try Data("\(bundleID)\n".utf8).write(to: URL(fileURLWithPath: file))+ } catch {+ print("warning: Failed to write metadata to SUPERSIGN_METADATA_FILE: \(error)")+ }+ }+ } catch {+ print("\nFailed :(")+ print("Error: \(error)")+ return+ }}}diff --git a/Sources/SupersignCLISupport/SupersignCLIDelegate.swift b/Sources/SupersignCLISupport/SupersignCLIDelegate.swiftindex f8af46b..3cb3e64 100644--- a/Sources/SupersignCLISupport/SupersignCLIDelegate.swift+++ b/Sources/SupersignCLISupport/SupersignCLIDelegate.swift@@ -11,30 +11,29 @@ final class SupersignCLIAuthDelegate: TwoFactorAuthDelegate {}}-final class SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDelegate {+actor SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDelegate {public enum Error: Swift.Error {+ case decompressionFailedcase compressionFailed}let preferredTeam: DeveloperServicesTeam.ID?- let completion: () -> Void- init(preferredTeam: DeveloperServicesTeam.ID?, completion: @escaping () -> Void) {+ init(preferredTeam: DeveloperServicesTeam.ID?) {self.preferredTeam = preferredTeam- self.completion = completion}func fetchCode() async -> String? {await _fetchCode()}- func fetchTeam(fromTeams teams: [DeveloperServicesTeam], completion: @escaping (DeveloperServicesTeam?) -> Void) {+ func fetchTeam(fromTeams teams: [DeveloperServicesTeam]) async -> DeveloperServicesTeam? {if let preferredTeam = preferredTeam {// Fails if a team with the requested ID isn't found.// This is intentional to avoid interactivity.- return completion(teams.first(where: { $0.id == preferredTeam }))+ return teams.first(where: { $0.id == preferredTeam })}- let selected = Console.choose(+ return Console.choose(from: teams,onNoElement: { fatalError("No development teams available") },multiPrompt: "\nSelect a team",@@ -42,10 +41,9 @@ final class SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDele"\($0.name) (\($0.id.rawValue))"})- completion(selected)}- func setPresentedMessage(_ message: IntegratedInstaller.Message?) {+ nonisolated func setPresentedMessage(_ message: IntegratedInstaller.Message?) {let text: Stringswitch message {case .pairDevice:@@ -56,13 +54,13 @@ final class SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDeletext = "Continuing..."}print("\n\(text)", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)}var prevStage: String?var prevProgress: String?- func installerDidUpdate(toStage stage: String, progress: Double?) {+ private func _installerDidUpdate(toStage stage: String, progress: Double?) {let progString: String?if let progress = progress {let progInt = Int(progress * 100)@@ -85,39 +83,24 @@ final class SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDeleif stage != prevStage {if let progString = progString {print("\n[\(stage)] \(progString)", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)} else {print("\n[\(stage)] ...", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)}} else if progString != prevProgress {if let progString = progString {print("\r[\(stage)] \(progString)", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)} else {print("\r[\(stage)]", terminator: "")- fflush(stdout)+ fflush(stdoutSafe)}}}- func installerDidComplete(withResult result: Result<String, Swift.Error>) {- print("\n")- switch result {- case .success(let bundleID):- print("Successfully installed!")- if let file = ProcessInfo.processInfo.environment["SUPERSIGN_METADATA_FILE"] {- do {- try Data("\(bundleID)\n".utf8).write(to: URL(fileURLWithPath: file))- } catch {- print("warning: Failed to write metadata to SUPERSIGN_METADATA_FILE: \(error)")- }- }- case .failure(let error):- print("Failed :(")- print("Error: \(error)")- }- completion()+ nonisolated func installerDidUpdate(toStage stage: String, progress: Double?) {+ Task { await _installerDidUpdate(toStage: stage, progress: progress) }}private static let expiryFormatter: DateFormatter = {@@ -142,26 +125,23 @@ final class SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDelefunc decompress(ipa: URL,in directory: URL,- progress: @escaping (Double?) -> Void,- completion: @escaping (_ success: Bool) -> Void- ) {+ progress: @escaping (Double?) -> Void+ ) async throws {progress(nil)let unzip = Process()unzip.launchPath = "/usr/bin/unzip"unzip.arguments = ["-q", ipa.path, "-d", directory.path]- unzip.launch()- unzip.waitUntilExit()- guard unzip.terminationStatus == 0 else { return completion(false) }-- completion(true)+ try await unzip.launchAndWait()+ guard unzip.terminationStatus == 0 else {+ throw Error.decompressionFailed+ }}func compress(payloadDir: URL,- progress: @escaping (Double?) -> Void,- completion: @escaping (Result<URL, Swift.Error>) -> Void- ) {+ progress: @escaping (Double?) -> Void+ ) async throws -> URL {progress(nil)let dest = payloadDir.deletingLastPathComponent().appendingPathComponent("app.ipa")@@ -170,10 +150,26 @@ final class SupersignCLIDelegate: IntegratedInstallerDelegate, TwoFactorAuthDelezip.launchPath = "/usr/bin/zip"zip.currentDirectoryPath = payloadDir.deletingLastPathComponent().pathzip.arguments = ["-yqru0", dest.path, "Payload"]- zip.launch()- zip.waitUntilExit()- guard zip.terminationStatus == 0 else { return completion(.failure(Error.compressionFailed)) }+ try await zip.launchAndWait()+ guard zip.terminationStatus == 0 else { throw Error.compressionFailed }++ return dest+ }+}- completion(.success(dest))+extension Process {+ fileprivate func launchAndWait() async throws {+ try await withCheckedThrowingContinuation { continuation in+ terminationHandler = { _ in+ continuation.resume()+ }+ do {+ try self.run()+ } catch {+ continuation.resume(throwing: error)+ return+ }+ Task.detached { self.waitUntilExit() }+ }}}diff --git a/Sources/SupersignCLISupport/SupersignCommand.swift b/Sources/SupersignCLISupport/SupersignCommand.swiftindex 7530408..c9050d0 100644--- a/Sources/SupersignCLISupport/SupersignCommand.swift+++ b/Sources/SupersignCLISupport/SupersignCommand.swift@@ -3,7 +3,7 @@ import Supersignimport ArgumentParserpublic enum SupersignCLI {- public struct Configuration {+ public struct Configuration: Sendable {public let superchargeApp: URL?public let storage: KeyValueStorage@@ -16,7 +16,7 @@ public enum SupersignCLI {}}- private static var _config: Configuration!+ private static nonisolated(unsafe) var _config: Configuration!static var config: Configuration { _config }public static func run(configuration: Configuration, arguments: [String]? = nil) async throws {diff --git a/Sources/SupersignCLISupport/UninstallCommand.swift b/Sources/SupersignCLISupport/UninstallCommand.swiftindex d428d11..7622139 100644--- a/Sources/SupersignCLISupport/UninstallCommand.swift+++ b/Sources/SupersignCLISupport/UninstallCommand.swift@@ -3,7 +3,7 @@ import Supersignimport SwiftyMobileDeviceimport ArgumentParser-struct UninstallCommand: ParsableCommand {+struct UninstallCommand: AsyncParsableCommand {static let configuration = CommandConfiguration(commandName: "uninstall",abstract: "Uninstall an installed app"@@ -15,25 +15,17 @@ struct UninstallCommand: ParsableCommand {help: "The app to uninstall") var bundleID: String- func run() throws {+ func run() async throws {let installProxy = try InstallationProxyClient(device: connection.device, label: "supersign-inst")- let sem = DispatchSemaphore(value: 0)- var error: Error?- installProxy.uninstall(- bundleID: bundleID,- progress: { _ in },- completion: { result in- if case let .failure(err) = result {- error = err- }- sem.signal()- }- )- sem.wait()- if let error = error {+ do {+ try await installProxy.uninstall(+ bundleID: bundleID,+ progress: { _ in }+ )+ } catch {print("Failed: \(error)")- } else {- print("Success!")+ return}+ print("Success!")}}