diff --git a/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift b/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift index 0be5c699..6a2af3ed 100644 --- a/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift +++ b/Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift @@ -165,7 +165,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? await context.signerImpl.analyze(executable: executableURL), + if let entitlementsData = try? await context.signer.analyze(executable: executableURL), let decodedEntitlements = try? PropertyListDecoder().decode(Entitlements.self, from: entitlementsData) { entitlements = decodedEntitlements diff --git a/Sources/XKit/Signer/AutoSigner.swift b/Sources/XKit/Signer/AutoSigner.swift index 15767e72..b19dde8d 100644 --- a/Sources/XKit/Signer/AutoSigner.swift +++ b/Sources/XKit/Signer/AutoSigner.swift @@ -1,13 +1,6 @@ -// -// Signer.swift -// XKit -// -// Created by Kabir Oberai on 13/10/19. -// Copyright © 2019 Kabir Oberai. All rights reserved. -// - import Foundation +/// Provisions and codesigns. public struct AutoSigner { public enum Error: LocalizedError { @@ -92,7 +85,7 @@ public struct AutoSigner { let entitlements = provisioningDict.mapValues(\.entitlements) status(NSLocalizedString("signer.signing", value: "Signing", comment: "")) - try await context.signerImpl.sign( + try await context.signer.sign( app: app, identity: .real(signingInfo.certificate, signingInfo.privateKey), entitlementMapping: entitlements, diff --git a/Sources/XKit/Signer/SignerImpl.swift b/Sources/XKit/Signer/Signer.swift similarity index 94% rename from Sources/XKit/Signer/SignerImpl.swift rename to Sources/XKit/Signer/Signer.swift index 13507aa1..4afc9e65 100644 --- a/Sources/XKit/Signer/SignerImpl.swift +++ b/Sources/XKit/Signer/Signer.swift @@ -1,18 +1,10 @@ -// -// SignerImpl.swift -// XKit -// -// Created by Kabir Oberai on 10/10/19. -// Copyright © 2019 Kabir Oberai. All rights reserved. -// - import Foundation import CXKit import SignerSupport import ConcurrencyExtras /// a wrapper around `signer_t` -public actor SignerImpl { +public actor Signer { public enum Error: LocalizedError { case notFound @@ -53,17 +45,17 @@ public actor SignerImpl { self.signer = signer.value } - public static func all() -> some Collection { + public static func all() -> some Collection { var list = get_signers() - var arr: [SignerImpl] = [] + var arr: [Signer] = [] while let curr = list { - arr.append(SignerImpl(signer: UncheckedSendable(curr))) + arr.append(Signer(signer: UncheckedSendable(curr))) list = curr.pointee.next } return arr } - public static func first() throws -> SignerImpl { + public static func first() throws -> Signer { try all().first.orThrow(Error.notFound) } diff --git a/Sources/XKit/Signer/SigningContext.swift b/Sources/XKit/Signer/SigningContext.swift index 6b8db549..46cf5759 100644 --- a/Sources/XKit/Signer/SigningContext.swift +++ b/Sources/XKit/Signer/SigningContext.swift @@ -14,7 +14,7 @@ public struct SigningContext: Sendable { public let udid: String public let deviceName: String public let auth: DeveloperAPIAuthData - public let signerImpl: SignerImpl + public let signer: Signer public var developerAPIClient: DeveloperAPIClient { DeveloperAPIClient(auth: auth) @@ -24,12 +24,12 @@ public struct SigningContext: Sendable { udid: String, deviceName: String, auth: DeveloperAPIAuthData, - signerImpl: SignerImpl? = nil + signer: Signer? = nil ) throws { self.udid = udid self.deviceName = deviceName self.auth = auth - self.signerImpl = try signerImpl ?? .first() + self.signer = try signer ?? .first() } } diff --git a/Sources/XToolSupport/DevCommand.swift b/Sources/XToolSupport/DevCommand.swift index b1643e8d..f5e4cf53 100644 --- a/Sources/XToolSupport/DevCommand.swift +++ b/Sources/XToolSupport/DevCommand.swift @@ -69,7 +69,7 @@ struct PackOperation { let decoder = PropertyListDecoder() let entitlements = try decoder.decode(Entitlements.self, from: data) print("Pseudo-signing...") - try await SignerImpl.first().sign( + try await Signer.first().sign( app: bundle, identity: .adhoc, entitlementMapping: [bundle: entitlements],