From 2728965279bcd9ca9969974633ce913b0f68d78a Mon Sep 17 00:00:00 2001 From: nab138 Date: Wed, 18 Feb 2026 17:22:06 -0500 Subject: [PATCH] Better error handling in get_app_token --- Cargo.lock | 2 +- isideload/Cargo.toml | 2 +- isideload/src/auth/apple_account.rs | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aeab7f8..3070888 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1831,7 +1831,7 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "isideload" -version = "0.2.9" +version = "0.2.10" dependencies = [ "aes 0.9.0-rc.4", "aes-gcm", diff --git a/isideload/Cargo.toml b/isideload/Cargo.toml index 1a5e28c..f13c462 100644 --- a/isideload/Cargo.toml +++ b/isideload/Cargo.toml @@ -3,7 +3,7 @@ name = "isideload" description = "Sideload iOS/iPadOS applications" license = "MIT" authors = ["Nicholas Sharp "] -version = "0.2.9" +version = "0.2.10" edition = "2024" repository = "https://github.com/nab138/isideload" documentation = "https://docs.rs/isideload" diff --git a/isideload/src/auth/apple_account.rs b/isideload/src/auth/apple_account.rs index 291ce04..afabf8d 100644 --- a/isideload/src/auth/apple_account.rs +++ b/isideload/src/auth/apple_account.rs @@ -6,7 +6,7 @@ use crate::{ builder::AppleAccountBuilder, grandslam::{GrandSlam, GrandSlamErrorChecker}, }, - util::plist::PlistDataExtract, + util::plist::{PlistDataExtract, SensitivePlistAttachment}, }; use aes::{ Aes256, @@ -440,7 +440,7 @@ impl AppleAccount { let verifier = srp_client .process_reply(&a, self.email.as_bytes(), &password_buf, salt, b_pub) - .unwrap(); + .context("Failed to compute SRP proof")?; let req2 = plist!(dict { "Header": { @@ -534,7 +534,8 @@ impl AppleAccount { let c = spd.get_data("c").context("Failed to get app token")?; let checksum = Hmac::::new_from_slice(session_key) - .unwrap() + .context("Failed to create HMAC for app token checksum") + .attach_with(|| SensitivePlistAttachment::new(spd.clone()))? .chain_update("apptokens".as_bytes()) .chain_update(dsid.as_bytes()) .chain_update(app.as_bytes()) @@ -604,6 +605,8 @@ impl AppleAccount { .context("Failed to get app token expiry")? as u64, }; + info!("Successfully retrieved app token for {}", app); + Ok(app_token) }