Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

More fixes

Kabir Oberai7e0bd6310b40
diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift
index 7c92ebd..664201c 100644
--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift
+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift
@@ -189,7 +189,7 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
let appID = try await upsertApp(bundleID: bundleID, entitlements: entitlements, isFreeTeam: isFreeTeam, appIDs: appIDs)
let newBundleID = appID.attributes!.identifier!
- let teamID = try signingInfo.certificate.developerIdentity()
+ let teamID = try signingInfo.certificate.teamID()
try entitlements.update(
teamID: .init(rawValue: teamID),
bundleID: newBundleID
diff --git a/Sources/Supersign/Model/Certificate.swift b/Sources/Supersign/Model/Certificate.swift
index c05e010..b6b745c 100644
--- a/Sources/Supersign/Model/Certificate.swift
+++ b/Sources/Supersign/Model/Certificate.swift
@@ -42,12 +42,20 @@ public struct Certificate: Codable, Sendable {
try container.encode(data())
}
- public func developerIdentity() throws -> String {
- let commonName = raw.subject.lazy.flatMap { $0 }.first { $0.type == .NameAttributes.commonName }
+ private func subjectAttribute(_ attribute: ASN1ObjectIdentifier) throws -> String {
+ let commonName = raw.subject.lazy.flatMap { $0 }.first { $0.type == attribute }
guard let commonName else { throw Error.invalidCertificate }
return "\(commonName.value)"
}
+ public func developerIdentity() throws -> String {
+ try subjectAttribute(.NameAttributes.commonName)
+ }
+
+ public func teamID() throws -> String {
+ try subjectAttribute(.NameAttributes.organizationalUnitName)
+ }
+
public func serialNumber() -> String {
// big endian, hex-encoded
let content = raw.serialNumber.bytes.lazy