Authentication rework, cache session, save and login with adsid and xcodeToken to alleviate GSA connection issue in some regions. Fix a timezone issue when extracting anisette data

This commit is contained in:
Huge_Black
2026-01-24 14:13:53 +08:00
committed by nythepegasus
parent 1d642e2ffa
commit cc5aeaf099
3 changed files with 168 additions and 62 deletions

View File

@@ -53,6 +53,12 @@ public class Keychain
@KeychainItem(key: "appleIDPassword")
public var appleIDPassword: String?
@KeychainItem(key: "appleIDAdsid")
public var appleIDAdsid: String?
@KeychainItem(key: "appleIDXcodeToken")
public var appleIDXcodeToken: String?
@KeychainItem(key: "signingCertificatePrivateKey")
public var signingCertificatePrivateKey: Data?
@@ -83,6 +89,12 @@ public class Keychain
@KeychainItem(key: "adiPb")
public var adiPb: String?
// for some reason authenticated cert/session/team is completely not cached, which result in logging in for every request
// we save it here so when user logs out we can clear cached account/session/team
public var certificate: ALTCertificate? = nil
public var session: ALTAppleAPISession? = nil
public var team: ALTTeam? = nil
private init()
{
}
@@ -91,7 +103,13 @@ public class Keychain
{
self.appleIDEmailAddress = nil
self.appleIDPassword = nil
self.appleIDAdsid = nil
self.appleIDXcodeToken = nil
self.signingCertificatePrivateKey = nil
self.signingCertificateSerialNumber = nil
self.certificate = nil
self.session = nil
self.team = nil
}
}