SignerImpl -> Signer

This commit is contained in:
Kabir Oberai
2025-05-24 00:17:06 +05:30
Unverified
parent 8164bd6725
commit c2e3ae8ecf
5 changed files with 12 additions and 27 deletions
@@ -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
+2 -9
View File
@@ -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,
@@ -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<SignerImpl> {
public static func all() -> some Collection<Signer> {
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)
}
+3 -3
View File
@@ -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()
}
}
+1 -1
View File
@@ -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],