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 cleanup

Kabir Oberai0f1eac8a923a
diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift
index e9df8d7..68f3ac2 100644
--- a/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift
+++ b/Sources/Supersign/DeveloperServices/DeveloperServicesLoginManager.swift
@@ -68,6 +68,7 @@ public struct DeveloperServicesLoginManager: Sendable {
password: password,
twoFactorDelegate: twoFactorDelegate
).authenticate()
+ _ = twoFactorDelegate
return try await self.logIn(withLoginData: loginData)
}
diff --git a/Sources/Supersign/module.modulemap b/Sources/Supersign/module.modulemap
deleted file mode 100644
index 754e3cd..0000000
--- a/Sources/Supersign/module.modulemap
+++ /dev/null
@@ -1,6 +0,0 @@
-framework module Supersign {
- umbrella header "Supersign.h"
-
- export *
- module * { export * }
-}
diff --git a/Sources/SupersignCLISupport/DSCommand.swift b/Sources/SupersignCLISupport/DSCommand.swift
index 4811d89..df3c281 100644
--- a/Sources/SupersignCLISupport/DSCommand.swift
+++ b/Sources/SupersignCLISupport/DSCommand.swift
@@ -11,13 +11,21 @@ extension DeviceInfo {
}
}
-private extension AuthToken {
- static func retrieve(
- deviceInfo: DeviceInfo,
- username: String?,
- password: String?,
- resetProvisioning: Bool = false
- ) async throws -> Self {
+struct DSLoginCommand: AsyncParsableCommand {
+ static let configuration = CommandConfiguration(
+ commandName: "login",
+ abstract: "Obtain an Apple ID authentication token"
+ )
+
+ @Flag(name: [.short, .long]) var resetProvisioning = false
+ @Option(name: [.short, .long], help: "Apple ID") var username: String?
+ @Option(name: [.short, .long]) var password: String?
+ @Flag(
+ name: [.long],
+ help: "Print the auth token to standard output instead of persisting it."
+ ) var printToken = false
+
+ func run() async throws {
guard let username = username ?? Console.prompt("Apple ID: "), !username.isEmpty else {
throw Console.Error("A non-empty Apple ID is required.")
}
@@ -25,6 +33,8 @@ private extension AuthToken {
throw Console.Error("A non-empty password is required.")
}
+ let deviceInfo = try DeviceInfo.fetch()
+
let provider = try ADIDataProvider.adiProvider(
deviceInfo: deviceInfo,
storage: SupersignCLI.config.storage
@@ -42,40 +52,8 @@ private extension AuthToken {
password: password,
twoFactorDelegate: authDelegate
)
- _ = authDelegate
- return AuthToken(appleID: username, dsToken: token)
- }
+ let fullToken = AuthToken(appleID: username, dsToken: token)
- static func retrieve(deviceInfo: DeviceInfo, account: String?) async throws -> Self {
- if let account = account, let token = Self(string: account) {
- return token
- } else {
- return try await retrieve(deviceInfo: deviceInfo, username: account, password: nil)
- }
- }
-}
-
-struct DSLoginCommand: AsyncParsableCommand {
- static let configuration = CommandConfiguration(
- commandName: "login",
- abstract: "Obtain an Apple ID authentication token"
- )
-
- @Flag(name: [.short, .long]) var resetProvisioning = false
- @Option(name: [.short, .long], help: "Apple ID") var username: String?
- @Option(name: [.short, .long]) var password: String?
- @Flag(
- name: [.long],
- help: "Print the auth token to standard output instead of persisting it."
- ) var printToken = false
-
- func run() async throws {
- let fullToken = try await AuthToken.retrieve(
- deviceInfo: .fetch(),
- username: self.username,
- password: self.password,
- resetProvisioning: resetProvisioning
- )
if printToken {
guard let string = fullToken.string else {
throw Console.Error("Could not encode token.")