Skip to content

Commit 24c1810

Browse files
committed
Circle fixes
1 parent 2ffe630 commit 24c1810

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

icloud-auth/src/client.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub struct CircleSendMessage {
111111
pub atxid: String,
112112
pub circlestep: u32,
113113
pub idmsdata: Option<String>,
114-
pub pakedata: String,
114+
pub pakedata: Option<String>,
115115
pub ptkn: String,
116116
pub ec: Option<i32>,
117117
}
@@ -157,6 +157,11 @@ pub struct VerifyBody {
157157
security_code: Option<VerifyCode>
158158
}
159159

160+
#[derive(Deserialize)]
161+
pub struct CircleResponse {
162+
pub sid: Option<String>,
163+
}
164+
160165
#[repr(C)]
161166
#[derive(Deserialize)]
162167
#[serde(rename_all = "camelCase")]
@@ -209,7 +214,7 @@ impl<T: AnisetteProvider> AppleAccount<T> {
209214
let client = ClientBuilder::new()
210215
.cookie_store(true)
211216
.add_root_certificate(Certificate::from_der(APPLE_ROOT)?)
212-
// .proxy(Proxy::https("https://192.168.86.82:8080").unwrap())
217+
// .proxy(Proxy::https("https://192.168.99.87:8080").unwrap())
213218
// .danger_accept_invalid_certs(true)
214219
.http1_title_case_headers()
215220
.connection_verbose(true)
@@ -352,7 +357,7 @@ impl<T: AnisetteProvider> AppleAccount<T> {
352357
&mut self,
353358
message: &CircleSendMessage,
354359
is_twofa: bool,
355-
) -> Result<LoginState, Error> {
360+
) -> Result<CircleResponse, Error> {
356361

357362
let valid_anisette = self.get_anisette().await?;
358363

@@ -405,7 +410,9 @@ impl<T: AnisetteProvider> AppleAccount<T> {
405410
return Err(Error::AuthSrp)
406411
}
407412

408-
Ok(LoginState::LoggedIn)
413+
let response = res.bytes().await?;
414+
415+
Ok(plist::from_bytes(&response)?)
409416
}
410417

411418
pub async fn logout_all(&mut self, device_name: &str) -> Result<(), Error> {
@@ -779,7 +786,7 @@ impl<T: AnisetteProvider> AppleAccount<T> {
779786

780787
let res = self
781788
.client
782-
.put("https://gsa.apple.com/auth/verify/phone/")
789+
.put("https://gsa.apple.com/auth/verify/phone")
783790
.headers(headers.await?)
784791
.header("Accept", "application/json")
785792
.json(&body)

icloud-auth/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ mod client;
33
use std::fmt::Display;
44

55
pub use client::{AppleAccount, LoginState, TrustedPhoneNumber, AuthenticationExtras, VerifyBody, CircleSendMessage};
6-
pub use omnisette::{LoginClientInfo, ArcAnisetteClient};
6+
pub use omnisette::{LoginClientInfo, default_provider, ArcAnisetteClient, DefaultAnisetteProvider};
7+
8+
79

810
use thiserror::Error;
911
#[derive(Debug, Error)]

0 commit comments

Comments
 (0)