Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ public protocol RawADIProvider: Sendable {

extension RawADIProvider {
public func clientInfo() async throws -> String {
// Looks like Apple detects attempts to use a macOS client string on Windows :/
"""
<PC> <Windows;6.2(0,0);9200> <com.apple.AuthKitWin/1 (com.apple.iCloud/7.21)>
"""
// Must match the client info used for GSA auth, since the ADI data is Android-generated.
DeviceInfo.ClientInfo.androidClientString
}
}

Expand Down
18 changes: 14 additions & 4 deletions Sources/XKit/GrandSlam/Anisette/DeviceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ public struct DeviceInfo: Codable, Sendable {
public struct ClientInfo: Codable {
public let modelID: String // e.g. MacBookPro11,5

/// Our Anisette data comes from Android ADI, so every GSA request (including
/// provisioning) has to identify as an Android device or GSA rejects it (-80045).
static let androidClientString = """
<Pixel 7> <Android;14;UQ1A.240205.002> <com.apple.AuthKit/1 (com.apple.akd/1.0)>
"""

/// Only used for the GSA URL bag lookup: sending the Android client info there
/// returns a reduced bag pointing at gsd.apple.com, which doesn't work for us.
static let urlBagClientString = """
<Mac15,7> <macOS;27.0;26A5378j> <com.apple.AuthKit/1 (com.apple.akd/1.0)>
"""

var clientString: String {
"""
<Pixel 7> <Android;14;UQ1A.240205.002> <com.apple.AuthKit/1 (com.apple.akd/1.0)>
"""
Self.androidClientString
}

var userAgent: String {
"AuthKit/1 (Macintosh; OS X 27.0) (com.apple.dt.Xcode/26.5)"
"akd/1.0 CFNetwork/808.1.4"
}

public init(modelID: String) {
Expand Down
11 changes: 0 additions & 11 deletions Sources/XKit/GrandSlam/Anisette/OmnisetteADIProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ struct OmnisetteADIProvider: RawADIProvider {
return encoder
}()

func clientInfo() async throws -> String {
struct ClientInfo: Decodable {
let clientInfo: String
}
let body = try await client.makeRequest(
HTTPRequest(url: url.appendingPathComponent("v3/client_info"))
).body
let clientInfo = try Self.decoder.decode(ClientInfo.self, from: body)
return clientInfo.clientInfo
}

func startProvisioning(spim: Data, userID: UUID) async throws -> (RawADIProvisioningSession, Data) {
var url = url.appendingPathComponent("v3/provisioning_session")
var components = URLComponents(url: url, resolvingAgainstBaseURL: false)!
Expand Down
6 changes: 0 additions & 6 deletions Sources/XKit/GrandSlam/Anisette/XADIProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ public actor XADIProvider: RawADIProvider {
try await loadTask.value
}

public func clientInfo() async throws -> String {
"""
<MacBookPro13,2> <macOS;13.1;22C65> <com.apple.AuthKit/1 (com.apple.dt.Xcode/3594.4.19)>
"""
}

public func startProvisioning(spim: Data, userID: UUID) async throws -> (any RawADIProvisioningSession, Data) {
try await loadADI(id: userID)

Expand Down
2 changes: 1 addition & 1 deletion Sources/XKit/GrandSlam/Lookup/GrandSlamLookupManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ actor GrandSlamLookupManager {
var request = HTTPRequest(url: Self.lookupURL)
request.headerFields = [
.userAgent: deviceInfo.clientInfo.userAgent,
.init(DeviceInfo.clientInfoKey)!: deviceInfo.clientInfo.clientString,
.init(DeviceInfo.clientInfoKey)!: DeviceInfo.ClientInfo.urlBagClientString,
.init(DeviceInfo.deviceIDKey)!: deviceInfo.deviceID,
.init(AnisetteData.iLocaleKey)!: Locale.current.identifier,
.init(AnisetteData.timeZoneKey)!: TimeZone.current.identifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ extension GrandSlamOperationRequest {
"svct": "iCloud",
"loc": Locale.current.identifier
]
clientData.merge(deviceInfo.dictionary) { _, b in b }
// Don't include deviceInfo.dictionary: its Mac hardware identifiers (ROM/MLB/serial)
// contradict the Android client info and Anisette data.
clientData.merge(anisetteData.dictionary) { _, b in b }

var request: [String: Any] = [
Expand Down
2 changes: 1 addition & 1 deletion Sources/XToolSupport/AuthCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct AuthOperation {
private func logInWithPassword() async throws -> AuthToken {
print("""
Heads up:
This works by emulating a Pixel phone/Windows PC to interact with Apple services;
This works by emulating a Pixel phone to interact with Apple services;
consider using a secondary Apple ID. Credentials are only ever sent to Apple.
""")

Expand Down