Start sideload method

This commit is contained in:
nab138
2026-02-02 11:13:31 -05:00
parent ae49b22650
commit 1a7e305297
4 changed files with 63 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ use rootcause::{
pub mod anisette;
pub mod auth;
pub mod dev;
pub mod sideload;
pub mod util;
#[derive(Debug, thiserror::Error)]
@@ -23,6 +24,7 @@ pub enum SideloadError {
DeveloperError(i64, String),
}
// The default reqwest error formatter sucks and provides no info
struct ReqwestErrorFormatter;
impl ContextFormatterHook<reqwest::Error> for ReqwestErrorFormatter {

View File

@@ -0,0 +1,16 @@
use std::path::PathBuf;
use idevice::provider::IdeviceProvider;
use rootcause::prelude::*;
use crate::dev::developer_session::DeveloperSession;
use crate::util::device::IdeviceInfo;
pub async fn sideload_app(
device_provider: &impl IdeviceProvider,
dev_session: &DeveloperSession,
app_path: PathBuf,
) -> Result<(), Report> {
let device_info = IdeviceInfo::from_device(device_provider).await?;
Ok(())
}

View File

@@ -0,0 +1,44 @@
use idevice::{IdeviceService, lockdown::LockdownClient, provider::IdeviceProvider};
use rootcause::prelude::*;
pub struct IdeviceInfo {
pub name: String,
pub udid: String,
}
impl IdeviceInfo {
pub fn new(name: String, udid: String) -> Self {
Self { name, udid }
}
pub async fn from_device(device: &impl IdeviceProvider) -> Result<Self, Report> {
let mut lockdown = LockdownClient::connect(device)
.await
.context("Failed to connect to device lockdown")?;
let pairing = device
.get_pairing_file()
.await
.context("Failed to get device pairing file")?;
lockdown
.start_session(&pairing)
.await
.context("Failed to start lockdown session")?;
let device_name = lockdown
.get_value(Some("DeviceName"), None)
.await
.context("Failed to get device name")?
.as_string()
.ok_or_else(|| report!("Device name is not a string"))?
.to_string();
let device_udid = lockdown
.get_value(Some("UniqueDeviceID"), None)
.await
.context("Failed to get device UDID")?
.as_string()
.ok_or_else(|| report!("Device UDID is not a string"))?
.to_string();
Ok(Self::new(device_name, device_udid))
}
}

View File

@@ -1 +1,2 @@
pub mod device;
pub mod plist;