use adi::proxy::ADIProxy; use grandslam::device::Device; use grandslam::http_session::AnisetteHTTPSession; use grandslam::{AccountHTTPSession, AuthOutcome}; use std::env; use xcode::v1::{BundleIDInclude, ListBundleIDsRequest, ListCertificatesRequest}; use xcode::{ListTeamsAction, TeamID, XCODE_BUNDLE_INFORMATION, XcodeSession}; #[tokio::main] async fn main() -> Result<(), Box> { env_logger::init(); let apple_id = env::var("APPLE_ID")?; let password = env::var("APPLE_PASSWORD")?; let core_adi_data = std::fs::read("nodistrib/lib/arm64-v8a/libCoreADI.so")?; let proxy = android_coreadi::AndroidCoreADIProxy::load_library(core_adi_data)?; adi::core_adi::CoreADIADIProxy::initialize(&proxy)?; proxy.set_android_id("0123456789012345")?; proxy.set_provisioning_path(c"./adi_files")?; let device = Device { device_model: "Mac16,8".to_string(), operating_system_information: "macOS;15.7.3;24G419".to_string(), device_uuid: "229B41B5-93B0-5632-9E1A-D4EF0669C3C1".to_string(), }; let http_session = AnisetteHTTPSession::new( grandslam::http_session(device, XCODE_BUNDLE_INFORMATION).await?, &proxy, ); if !proxy.is_machine_provisioned(grandslam::GRANDSLAM_DSID)? { grandslam::provision(&http_session).await?; } let server_provided_data = match grandslam::login(&http_session, &apple_id, &password).await? { AuthOutcome::Success(server_provided_data) | AuthOutcome::SecondaryActionRequired(Some(server_provided_data), _) => { server_provided_data } _ => return Err("This example does not handle secondary actions.".into()), }; let (alt_dsid, master) = match ( server_provided_data.alt_dsid(), server_provided_data.master_token(), ) { (Some(alt_dsid), Some(master)) => (alt_dsid, master), _ => return Err("GrandSlam did not return an account.".into()), }; let http_session = AccountHTTPSession::new(http_session, alt_dsid); let xcode_token = http_session.get_app_token(&master).await?; let xcode_session = XcodeSession::new(http_session, xcode_token); let team_id = match env::var("TEAM_ID") { Ok(team_id) => TeamID::from(team_id), Err(_) => { xcode_session .perform_developer_action(ListTeamsAction {}) .await?? .teams .into_iter() .next() .ok_or("This account has no developer team.")? .team_id } }; let mut request = ListBundleIDsRequest { include: vec![BundleIDInclude::BundleIDCapabilities], ..Default::default() }; loop { let response = xcode_session .perform_developer_api_request(&team_id, &request) .await??; println!("{:#?}", response.data); println!("{:#?}", response.included); match response.links.next_page() { Some(page) => request.page = page, None => break, } } let certificates = xcode_session .perform_developer_api_request(&team_id, &ListCertificatesRequest::default()) .await??; for certificate in certificates.data { println!( "{} ({}), expires {}", certificate.attributes.name, certificate.attributes.serial_number, certificate.attributes.expiration_date, ); } Ok(()) }