Modern Apps git

← xtool.git

More fixes

Commit
7e0bd6310b408a23f73c2b5545141acd99ae3f73
Author
Kabir Oberai <[email protected]>
When
2024-12-23 20:17 UTC (1 year ago)
Parents
cd87b11

Diff

Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift
diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swiftindex 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
Sources/Supersign/Model/Certificate.swift
diff --git a/Sources/Supersign/Model/Certificate.swift b/Sources/Supersign/Model/Certificate.swiftindex 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