Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.
DeveloperServices requests work again!
kabiroberai185e8b48a402
diff --git a/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swift b/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swiftindex eb92abe..8cc916c 100644--- a/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swift+++ b/Supersign/DeveloperServices/Certificates/DeveloperServicesCSRResponse.swift@@ -16,7 +16,6 @@ public struct DeveloperServicesCSRResponse: Decodable {public let id: IDpublic let certificateID: DeveloperServicesCertificate.IDpublic let serialNumber: DeveloperServicesCertificate.SerialNumber- public let type: DeveloperServicesCertificate.CertificateTypepublic let status: Stringpublic let statusCode: Intpublic let platform: DeveloperServicesPlatform@@ -27,7 +26,6 @@ public struct DeveloperServicesCSRResponse: Decodable {case id = "certRequestId"case certificateID = "certificateId"case serialNumber = "serialNum"- case type = "certificateType"case status = "statusString"case statusCodecase platform = "csrPlatform"diff --git a/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swift b/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swiftindex 2f7f1da..4e459a0 100644--- a/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swift+++ b/Supersign/DeveloperServices/Certificates/DeveloperServicesCertificate.swift@@ -19,39 +19,49 @@ public struct DeveloperServicesCertificate: Decodable {public let rawValue: Stringpublic init(rawValue: String) { self.rawValue = rawValue }}- public let serialNumber: SerialNumber- public struct CertificateType: Decodable {- public let displayID: String+ public enum Kind: String, Decodable, CaseIterable {+ case development = "DEVELOPMENT"+ case distribution = "DISTRIBUTION"+ case iOSDevelopment = "IOS_DEVELOPMENT"+ case iOSDistribution = "IOS_DISTRIBUTION"+ case macAppDistribution = "MAC_APP_DISTRIBUTION"+ case macInstallerDistribution = "MAC_INSTALLER_DISTRIBUTION"+ case developerIDKext = "DEVELOPER_ID_KEXT"+ case developerIDApplication = "DEVELOPER_ID_APPLICATION"+ case unknown++ public init(platform: DeveloperServicesPlatform) {+ switch platform {+ case .iOS: self = .iOSDevelopment+ default: self = .development+ }+ }++ public init(from decoder: Decoder) throws {+ let rawValue = try String(from: decoder)+ self = Self.allCases.first { $0.rawValue == rawValue } ?? .unknown+ }+ }++ public struct Attributes: Decodable {+ public let serialNumber: SerialNumberpublic let name: String- public let maxActive: Int+ public let kind: Kind+ public let expiry: Date+ public let machineID: String?+ public let machineName: String?+ public let content: Certificateprivate enum CodingKeys: String, CodingKey {- case displayID = "certificateTypeDisplayId"+ case serialNumbercase name- case maxActive+ case kind = "certificateType"+ case expiry = "expirationDate"+ case content = "certificateContent"+ case machineID = "machineId"+ case machineName}}- public let type: CertificateType-- public let status: String- public let statusCode: Int- public let expiry: Date- public let platform: DeveloperServicesPlatform- public let machineID: String?- public let machineName: String?- public let content: Certificate-- private enum CodingKeys: String, CodingKey {- case id = "certificateId"- case serialNumber- case type = "certificateType"- case status- case statusCode- case expiry = "expirationDate"- case platform = "certificatePlatform"- case content = "certContent"- case machineID = "machineId"- case machineName- }+ public let attributes: Attributes}diff --git a/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swift b/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swiftindex 34b299c..7fda131 100644--- a/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swift+++ b/Supersign/DeveloperServices/Certificates/DeveloperServicesFetchCertificateOperation.swift@@ -53,14 +53,13 @@ public struct DeveloperServicesFetchCertificateOperation: DeveloperServicesOperalet serialNumber = partialCert.serialNumberlet request = DeveloperServicesListCertificatesRequest(- platform: self.context.platform,- teamID: self.context.team.id+ teamID: self.context.team.id, certificateKind: .init(platform: self.context.platform))self.context.client.send(request) { result inguard let certificates = result.get(withErrorHandler: completion) else { return }- guard let fullCert = certificates.first(where: { $0.serialNumber == serialNumber })+ guard let fullCert = certificates.first(where: { $0.attributes.serialNumber == serialNumber })else { return completion(.failure(Error.csrFailed)) }- completion(.success(.init(privateKey: privateKey, certificate: fullCert.content)))+ completion(.success(.init(privateKey: privateKey, certificate: fullCert.attributes.content)))}}}@@ -79,11 +78,7 @@ public struct DeveloperServicesFetchCertificateOperation: DeveloperServicesOperacertificate: DeveloperServicesCertificate,completion: @escaping (Result<SigningInfo, Swift.Error>) -> Void) {- let request = DeveloperServicesRevokeCertificateRequest(- platform: context.platform,- teamID: context.team.id,- serialNumber: certificate.serialNumber- )+ let request = DeveloperServicesRevokeCertificateRequest(teamID: context.team.id, certificateID: certificate.id)context.client.send(request) { result inguard result.get(withErrorHandler: completion) != nil else { return }self.createAndSaveCertificate(completion: completion)@@ -92,19 +87,19 @@ public struct DeveloperServicesFetchCertificateOperation: DeveloperServicesOperapublic func perform(completion: @escaping (Result<SigningInfo, Swift.Error>) -> Void) {let request = DeveloperServicesListCertificatesRequest(- platform: context.platform, teamID: context.team.id+ teamID: context.team.id, certificateKind: .init(platform: context.platform))context.client.send(request) { result inguard let certificates = result.get(withErrorHandler: completion) else { return }- guard let certificate = certificates.first(where: { $0.machineID == self.context.udid }) else {+ guard let certificate = certificates.first(where: { $0.attributes.machineID == self.context.udid }) else {return self.createAndSaveCertificate(completion: completion)}guard let signingInfo = self.context.signingInfoManager[self.context.team.id],let serialNumber = try? signingInfo.certificate.serialNumber(),- certificate.serialNumber.rawValue == serialNumber,- certificate.expiry > Date()+ certificate.attributes.serialNumber.rawValue == serialNumber,+ certificate.attributes.expiry > Date()else { return self.revokeCreateSaveCertificate(certificate: certificate, completion: completion) }diff --git a/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swift b/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swiftindex c3fbf65..4b0a05c 100644--- a/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swift+++ b/Supersign/DeveloperServices/Certificates/DeveloperServicesListCertificatesRequest.swift@@ -8,28 +8,28 @@import Foundation-public struct DeveloperServicesListCertificatesRequest: DeveloperServicesPlatformRequest {+public struct DeveloperServicesListCertificatesRequest: DeveloperServicesRequest {- public struct Response: Decodable {- public let certificates: [DeveloperServicesCertificate]- }- public typealias Value = [DeveloperServicesCertificate]+ public typealias Response = [DeveloperServicesCertificate]+ public typealias Value = Response- public let platform: DeveloperServicesPlatform- public let teamID: DeveloperServicesTeam.ID+ public var apiVersion: DeveloperServicesAPIVersion { DeveloperServicesAPIVersionV1() }+ public var methodOverride: String? { "GET" }- var subAction: String { return "listAllDevelopmentCerts" }- var subParameters: [String: Any] {- return ["teamId": teamID.rawValue]- }-- public func parse(_ response: Response, completion: @escaping (Result<Value, Error>) -> Void) {- completion(.success(response.certificates))+ public let teamID: DeveloperServicesTeam.ID+ public let certificateKind: DeveloperServicesCertificate.Kind++ public var action: String { "certificates" }+ public var parameters: [String: Any] {+ [+ "teamId": teamID.rawValue,+ "filter[certificateType]": certificateKind.rawValue+ ]}- public init(platform: DeveloperServicesPlatform, teamID: DeveloperServicesTeam.ID) {- self.platform = platform+ public init(teamID: DeveloperServicesTeam.ID, certificateKind: DeveloperServicesCertificate.Kind) {self.teamID = teamID+ self.certificateKind = certificateKind}}diff --git a/Supersign/DeveloperServices/Certificates/DeveloperServicesRevokeCertificateRequest.swift b/Supersign/DeveloperServices/Certificates/DeveloperServicesRevokeCertificateRequest.swiftindex 6d9f0e9..7b0543e 100644--- a/Supersign/DeveloperServices/Certificates/DeveloperServicesRevokeCertificateRequest.swift+++ b/Supersign/DeveloperServices/Certificates/DeveloperServicesRevokeCertificateRequest.swift@@ -9,28 +9,28 @@import Foundation// swiftlint:disable:next type_name-public struct DeveloperServicesRevokeCertificateRequest: DeveloperServicesPlatformRequest {+public struct DeveloperServicesRevokeCertificateRequest: DeveloperServicesRequest {- public struct Response: Decodable {}+ public typealias Response = EmptyResponsepublic typealias Value = Response- public let platform: DeveloperServicesPlatform+ public var apiVersion: DeveloperServicesAPIVersion { DeveloperServicesAPIVersionV1() }+ public var methodOverride: String? { "DELETE" }+public let teamID: DeveloperServicesTeam.ID- public let serialNumber: DeveloperServicesCertificate.SerialNumber+ public let certificateID: DeveloperServicesCertificate.ID- var subAction: String { return "revokeDevelopmentCert" }- var subParameters: [String: Any] {- return ["teamId": teamID.rawValue, "serialNumber": serialNumber.rawValue]+ public var action: String { "certificates/\(certificateID.rawValue)" }+ public var parameters: [String: Any] {+ ["teamId": teamID.rawValue]}- init(- platform: DeveloperServicesPlatform,+ public init(teamID: DeveloperServicesTeam.ID,- serialNumber: DeveloperServicesCertificate.SerialNumber+ certificateID: DeveloperServicesCertificate.ID) {- self.platform = platformself.teamID = teamID- self.serialNumber = serialNumber+ self.certificateID = certificateID}}diff --git a/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swift b/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swiftnew file mode 100644index 0000000..68ebb6e--- /dev/null+++ b/Supersign/DeveloperServices/DeveloperServicesAPIVersion.swift@@ -0,0 +1,183 @@+//+// DeveloperServicesAPIVersion.swift+// Supersign+//+// Created by Kabir Oberai on 10/04/20.+// Copyright © 2020 Kabir Oberai. All rights reserved.+//++import Foundation++public protocol DeveloperServicesAPIVersion {+ func url(forAction action: String) -> URL?+ var contentType: String { get }+ var accept: String { get }+ func body(withParameters parameters: [String: Any]) throws -> Data+ func decode<R: Decodable>(response: Data) throws -> R+}++public struct DeveloperServicesAPIVersionOld: DeveloperServicesAPIVersion {++ public struct Error: LocalizedError {+ public let code: Int+ public let reason: String?++ public var errorDescription: String? {+ if let reason = reason {+ return String.localizedStringWithFormat(+ NSLocalizedString(+ "developer_services_api.old.error.reason_and_code",+ value: "%@ (%@)",+ comment: "First reason, then code"+ ),+ reason, "\(code)"+ )+ } else {+ return String.localizedStringWithFormat(+ NSLocalizedString(+ "developer_services_api.old.error.only_code",+ value: "An unknown error occurred (%@)",+ comment: ""+ ),+ "\(code)"+ )+ }+ }+ }++ private struct Response<T: Decodable>: Decodable {+ private let resultCode: PossiblyStringifiedNumber+ private let resultString: String?+ private let userString: String?+ private let inner: T?++ private enum CodingKeys: String, CodingKey {+ case resultCode+ case resultString+ case userString+ }++ init(from decoder: Decoder) throws {+ let container = try decoder.container(keyedBy: CodingKeys.self)+ self.resultCode = try container.decode(PossiblyStringifiedNumber.self, forKey: .resultCode)+ self.resultString = try container.decodeIfPresent(String.self, forKey: .resultString)+ self.userString = try container.decodeIfPresent(String.self, forKey: .userString)++ self.inner = resultCode.value == 0 ?+ try decoder.singleValueContainer().decode(T.self) :+ nil+ }++ var result: Result<T, Swift.Error> {+ if let inner = inner {+ return .success(inner)+ } else {+ return .failure(Error(+ code: resultCode.value,+ reason: userString ?? resultString+ ))+ }+ }+ }++ private static let serviceProtocolVersion = "QH65B2"+ private static let clientID = "XABBG36SBA"+ private static let decoder = PropertyListDecoder()++ public func url(forAction action: String) -> URL? {+ let urlString = """+ https://developerservices2.apple.com/services/\+ \(Self.serviceProtocolVersion)/\(action).action?\+ clientId=\(Self.clientID)+ """+ return URL(string: urlString)+ }++ public let contentType = "text/x-xml-plist"+ public let accept = "text/x-xml-plist"++ public func body(withParameters parameters: [String: Any]) throws -> Data {+ var parameters = parameters+ parameters["requestId"] = UUID().uuidString+ parameters["clientId"] = Self.clientID+ parameters["protocolVersion"] = Self.serviceProtocolVersion+ parameters["userLocale"] = [Locale.current.identifier]+ return try PropertyListSerialization.data(fromPropertyList: parameters, format: .xml, options: 0)+ }++ public func decode<R: Decodable>(response: Data) throws -> R {+ try Self.decoder+ .decode(Response<R>.self, from: response)+ .result.get()+ }++}++public struct DeveloperServicesAPIVersionV1: DeveloperServicesAPIVersion {++ public struct UnknownError: Swift.Error {}++ public struct Error: LocalizedError, Decodable {+ public let status: String+ public let code: String+ public let title: String+ public let detail: String++ public var errorDescription: String? {+ "\(code) (\(status)): \(title)\n\(detail)"+ }+ }++ private struct Response<T: Decodable>: Decodable {+ private let errors: [Error]?+ private let data: T?++ fileprivate var result: Result<T, Swift.Error> {+ if let data = data { return .success(data) }+ let errors = self.errors ?? []+ switch errors.count {+ case 0: return .failure(UnknownError())+ case 1: return .failure(errors[0])+ default: return .failure(ErrorList(errors))+ }+ }+ }++ private static let decoder: JSONDecoder = {+ let decoder = JSONDecoder()+ let formatter = DateFormatter()+ formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"+ decoder.dateDecodingStrategy = .formatted(formatter)+ return decoder+ }()++ public func url(forAction action: String) -> URL? {+ let urlString = "https://developerservices2.apple.com/services/v1/\(action)"+ return URL(string: urlString)+ }++ public let contentType = "application/vnd.api+json"+ public let accept = "application/vnd.api+json"++ public func body(withParameters parameters: [String: Any]) throws -> Data {+ var components = URLComponents()+ components.queryItems = parameters.map { URLQueryItem(name: $0, value: "\($1)") }+ let query = components.query ?? ""+ let dict = ["urlEncodedQueryParams": query]+ return try JSONSerialization.data(withJSONObject: dict)+ }++ public func decode<R: Decodable>(response: Data) throws -> R {+ // If `response` is empty and R is EmptyResponse, just return a new EmptyResponse+ // instead of crashing+ if let type = R.self as? EmptyResponse.Type {+ // swiftlint:disable:next force_cast+ return type.init() as! R+ } else {+ return try Self.decoder+ .decode(Response<R>.self, from: response)+ .result.get()+ }+ }++}diff --git a/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift b/Supersign/DeveloperServices/DeveloperServicesLoginManager.swiftnew file mode 100644index 0000000..c12818a--- /dev/null+++ b/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift@@ -0,0 +1,75 @@+//+// DeveloperServicesLoginManager.swift+// Supersign+//+// Created by Kabir Oberai on 10/04/20.+// Copyright © 2020 Kabir Oberai. All rights reserved.+//++import Foundation++public struct DeveloperServicesLoginToken: Codable {+ public let adsid: String+ public let token: String+ public let expiry: Date++ public init(adsid: String, token: String, expiry: Date) {+ self.adsid = adsid+ self.token = token+ self.expiry = expiry+ }+}++public struct DeveloperServicesLoginManager {++ public enum Error: Swift.Error {+ case missingLoginToken+ }++ public let deviceInfo: DeviceInfo+ public let anisetteProvider: AnisetteDataProvider+ private let client: GrandSlamClient++ public init(+ deviceInfo: DeviceInfo,+ customAnisetteProvider: AnisetteDataProvider? = nil+ ) {+ self.deviceInfo = deviceInfo+ self.anisetteProvider = customAnisetteProvider ?? ComputedAnisetteDataProvider(deviceInfo: deviceInfo)+ self.client = GrandSlamClient(deviceInfo: deviceInfo, customAnisetteDataProvider: anisetteProvider)+ }++ private func logIn(+ withLoginData loginData: GrandSlamLoginData,+ completion: @escaping (Result<DeveloperServicesLoginToken, Swift.Error>) -> Void+ ) {+ GrandSlamFetchAppTokensOperation(+ client: client,+ apps: [.xcode],+ loginData: loginData+ ).perform { result in+ guard let tokens = result.get(withErrorHandler: completion) else { return }+ guard let token = tokens[.xcode]+ else { return completion(.failure(Error.missingLoginToken)) }+ completion(.success(.init(adsid: loginData.adsid, token: token.value, expiry: token.expiry)))+ }+ }++ public func logIn(+ withUsername username: String,+ password: String,+ twoFactorDelegate: TwoFactorAuthDelegate,+ completion: @escaping (Result<DeveloperServicesLoginToken, Swift.Error>) -> Void+ ) {+ GrandSlamAuthenticateOperation(+ client: client,+ username: username,+ password: password,+ twoFactorDelegate: twoFactorDelegate+ ).authenticate { result in+ guard let loginData = result.get(withErrorHandler: completion) else { return }+ self.logIn(withLoginData: loginData, completion: completion)+ }+ }++}diff --git a/Supersign/DeveloperServices/DeveloperServicesRequest.swift b/Supersign/DeveloperServices/DeveloperServicesRequest.swiftindex 96b3793..e95d0f2 100644--- a/Supersign/DeveloperServices/DeveloperServicesRequest.swift+++ b/Supersign/DeveloperServices/DeveloperServicesRequest.swift@@ -8,11 +8,16 @@import Foundation+public struct EmptyResponse: Decodable {}+public protocol DeveloperServicesRequest {associatedtype Response: Decodableassociatedtype Value+ var apiVersion: DeveloperServicesAPIVersion { get }++ var methodOverride: String? { get }var action: String { get }var parameters: [String: Any] { get }@@ -22,6 +27,8 @@ public protocol DeveloperServicesRequest {}public extension DeveloperServicesRequest {+ var apiVersion: DeveloperServicesAPIVersion { DeveloperServicesAPIVersionOld() }+ var methodOverride: String? { nil }func configure(urlRequest: inout URLRequest) {}}diff --git a/Supersign/GrandSlam/Fingerprint/AnisetteData.swift b/Supersign/GrandSlam/Fingerprint/AnisetteData.swiftindex 0cb028e..ee7bd26 100644--- a/Supersign/GrandSlam/Fingerprint/AnisetteData.swift+++ b/Supersign/GrandSlam/Fingerprint/AnisetteData.swift@@ -19,6 +19,8 @@ public struct AnisetteData {return dateFormatter}()+ /// `X-Apple-I-Locale`+ static let iLocaleKey = "X-Apple-I-Locale"/// `X-Apple-Locale`static let localeKey = "X-Apple-Locale"public let locale: Locale = .currentdiff --git a/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift b/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swiftindex 2350e7a..3ba0713 100644--- a/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift+++ b/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift@@ -37,7 +37,7 @@ class GrandSlamLookupManager {request.setValue(deviceInfo.clientInfo.clientString, forHTTPHeaderField: DeviceInfo.clientInfoKey)request.setValue(deviceInfo.deviceID, forHTTPHeaderField: DeviceInfo.deviceIDKey)request.setValue(Locale.current.regionCode, forHTTPHeaderField: "X-MMe-Country")- request.setValue(Locale.current.identifier, forHTTPHeaderField: AnisetteData.localeKey)+ request.setValue(Locale.current.identifier, forHTTPHeaderField: AnisetteData.iLocaleKey)request.setValue(TimeZone.current.identifier, forHTTPHeaderField: AnisetteData.timeZoneKey)request.setValue("\(TimeZone.current.secondsFromGMT())", forHTTPHeaderField: "X-Apple-I-TimeZone-Offset")diff --git a/Supersign/GrandSlam/Operations/GrandSlamFetchAppTokensOperation.swift b/Supersign/GrandSlam/Operations/GrandSlamFetchAppTokensOperation.swiftindex f684f95..66a0dda 100644--- a/Supersign/GrandSlam/Operations/GrandSlamFetchAppTokensOperation.swift+++ b/Supersign/GrandSlam/Operations/GrandSlamFetchAppTokensOperation.swift@@ -8,6 +8,15 @@import Foundation+struct AppTokenKey: Hashable {+ let rawValue: String+ init(_ rawValue: String) { self.rawValue = rawValue }+}++extension AppTokenKey {+ static let xcode = AppTokenKey("com.apple.gs.xcode.auth")+}+class GrandSlamFetchAppTokensOperation {enum Error: Swift.Error {@@ -39,10 +48,10 @@ class GrandSlamFetchAppTokensOperation {private let decoder = PropertyListDecoder()let client: GrandSlamClient- let apps: [String]+ let apps: [AppTokenKey]let loginData: GrandSlamLoginData- init(client: GrandSlamClient, apps: [String], loginData: GrandSlamLoginData) {+ init(client: GrandSlamClient, apps: [AppTokenKey], loginData: GrandSlamLoginData) {self.client = clientself.apps = appsself.loginData = loginData@@ -50,18 +59,22 @@ class GrandSlamFetchAppTokensOperation {private func handle(response: GrandSlamAppTokensRequest.Decoder.Value,- completion: @escaping (Result<[String: Token], Swift.Error>) -> Void+ completion: @escaping (Result<[AppTokenKey: Token], Swift.Error>) -> Void) {guard let decrypted = AppTokensHelper.decryptGCM(response.encryptedToken, sk: self.loginData.sk)else { return completion(.failure(Error.invalidResponse)) }completion(Result {- try decoder.decode(Response.self, from: decrypted).tokens+ let pairs = try decoder+ .decode(Response.self, from: decrypted)+ .tokens+ .map { (AppTokenKey($0), $1) }+ return Dictionary(uniqueKeysWithValues: pairs)})}- func perform(completion: @escaping (Result<[String: Token], Swift.Error>) -> Void) {+ func perform(completion: @escaping (Result<[AppTokenKey: Token], Swift.Error>) -> Void) {let checksum = AppTokensHelper.createAppTokensChecksum(- withSK: loginData.sk, adsid: loginData.adsid, apps: apps+ withSK: loginData.sk, adsid: loginData.adsid, apps: apps.map { $0.rawValue })let appTokensRequest = GrandSlamAppTokensRequest(username: loginData.adsid,diff --git a/Supersign/GrandSlam/Requests/Concrete/GrandSlamAppTokensRequest.swift b/Supersign/GrandSlam/Requests/Concrete/GrandSlamAppTokensRequest.swiftindex d8e92af..086aa49 100644--- a/Supersign/GrandSlam/Requests/Concrete/GrandSlamAppTokensRequest.swift+++ b/Supersign/GrandSlam/Requests/Concrete/GrandSlamAppTokensRequest.swift@@ -22,14 +22,14 @@ struct GrandSlamAppTokensRequest: GrandSlamOperationRequest {static let operation = "apptokens"let username: String- let apps: [String]+ let apps: [AppTokenKey]let cookie: Datalet idmsToken: Stringlet checksum: Datavar parameters: [String: Any] {[- "app": apps,+ "app": apps.map { $0.rawValue },"c": cookie,"t": idmsToken,"checksum": checksumdiff --git a/SupersignTests/Tests/SupersignGrandSlamTests.swift b/SupersignTests/Tests/SupersignGrandSlamTests.swiftindex 1659063..8222b7f 100644--- a/SupersignTests/Tests/SupersignGrandSlamTests.swift+++ b/SupersignTests/Tests/SupersignGrandSlamTests.swift@@ -53,16 +53,16 @@ class SupersignGrandSlamTests: XCTestCase {let now = Date() // *before* the actual request is made- let tokWaiter = ResultWaiter<[String: GrandSlamFetchAppTokensOperation.Token]>(+ let tokWaiter = ResultWaiter<[AppTokenKey: GrandSlamFetchAppTokensOperation.Token]>(description: "Token request timed out")GrandSlamFetchAppTokensOperation(client: client,- apps: ["com.apple.gs.xcode.auth"],+ apps: [.xcode],loginData: loginData).perform(completion: tokWaiter.completion)let tokens = try XCTTry(tokWaiter.wait(timeout: 10000))- let token = try XCTUnwrap(tokens["com.apple.gs.xcode.auth"], "Xcode token absent from response")+ let token = try XCTUnwrap(tokens[.xcode], "Xcode token absent from response")XCTAssertGreaterThanOrEqual(token.expiry, now)XCTAssertFalse(token.value.isEmpty)}diff --git a/SupersignTests/Tests/SupersignSigningTests.swift b/SupersignTests/Tests/SupersignSigningTests.swiftindex 57151d9..9102e60 100644--- a/SupersignTests/Tests/SupersignSigningTests.swift+++ b/SupersignTests/Tests/SupersignSigningTests.swift@@ -57,7 +57,7 @@ class SupersignSigningTests: XCTestCase {let signingWaiter = ResultWaiter<()>(description: "Failed to sign app")signer.sign(app: app, status: { _ in }, progress: { _ in }, completion: signingWaiter.completion)- try signingWaiter.wait(timeout: 10000)+ try XCTTry(signingWaiter.wait(timeout: 10000))// TODO: Ensure entitlements are correct in new app, also codesign -vvvv}diff --git a/SupersignTests/Utilities/Config.swift b/SupersignTests/Utilities/Config.swiftindex ad07bdf..94c86f8 100644--- a/SupersignTests/Utilities/Config.swift+++ b/SupersignTests/Utilities/Config.swift@@ -13,8 +13,8 @@ struct Config: Decodable {struct AppleID: Decodable {let username: Stringlet password: String- /// for non-login tests, just provide a token already so that the 2fa prompt isn't invoked- let token: String+ /// for non-login tests, just provide a token already+ let token: DeveloperServicesLoginToken}let appleID: AppleIDdiff --git a/SupersignTests/Utilities/DeveloperServicesClient+Testing.swift b/SupersignTests/Utilities/DeveloperServicesClient+Testing.swiftindex f68b99f..f60a5f4 100644--- a/SupersignTests/Utilities/DeveloperServicesClient+Testing.swift+++ b/SupersignTests/Utilities/DeveloperServicesClient+Testing.swift@@ -18,9 +18,11 @@ struct CredentialsManagerMock: DeveloperServicesCredentialsManager {extension DeveloperServicesClient {static func test() -> DeveloperServicesClient {- let client = DeveloperServicesClient(credentialsManager: CredentialsManagerMock())- client.credentialsManager.token = .init(rawValue: Config.current.appleID.token)- return client+ DeveloperServicesClient(+ loginToken: Config.current.appleID.token,+ deviceInfo: Config.current.deviceInfo,+ customAnisetteDataProvider: DirectAnisetteDataProvider()+ )}func sendTest<T: DeveloperServicesRequest>(diff --git a/SupersignTests/config/config-template.json b/SupersignTests/config/config-template.jsonindex 060f993..e577670 100644--- a/SupersignTests/config/config-template.json+++ b/SupersignTests/config/config-template.json@@ -2,7 +2,11 @@"appleID": {"username": "","password": "",- "token": ""+ "token": {+ "adsid": "",+ "token": "",+ "expiry": 0+ }},"deviceInfo": {"clientInfo": {