start implimenting cert stuff

This commit is contained in:
nab138
2026-02-05 18:16:21 -05:00
parent bad2108e54
commit 27de2210ec
8 changed files with 47 additions and 5 deletions

11
Cargo.lock generated
View File

@@ -968,6 +968,7 @@ dependencies = [
"hex", "hex",
"hmac", "hmac",
"idevice", "idevice",
"keyring",
"pbkdf2", "pbkdf2",
"plist", "plist",
"plist-macro", "plist-macro",
@@ -1033,6 +1034,16 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "keyring"
version = "3.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c"
dependencies = [
"log",
"zeroize",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.5.0" version = "1.5.0"

View File

@@ -11,8 +11,9 @@ keywords = ["ios", "sideload"]
readme = "../README.md" readme = "../README.md"
[features] [features]
default = ["install"] default = ["install", "keyring-storage"]
install = ["dep:idevice"] install = ["dep:idevice"]
keyring-storage = ["keyring"]
[dependencies] [dependencies]
idevice = { version = "0.1.52", optional = true } idevice = { version = "0.1.52", optional = true }
@@ -39,3 +40,4 @@ cbc = { version = "0.2.0-rc.3", features = ["alloc"] }
aes = "0.9.0-rc.4" aes = "0.9.0-rc.4"
aes-gcm = "0.11.0-rc.3" aes-gcm = "0.11.0-rc.3"
tokio = "1.49.0" tokio = "1.49.0"
keyring = { version = "3.6.3", optional = true }

View File

@@ -20,7 +20,7 @@ use crate::auth::grandslam::GrandSlam;
use crate::util::plist::PlistDataExtract; use crate::util::plist::PlistDataExtract;
use futures_util::{SinkExt, StreamExt}; use futures_util::{SinkExt, StreamExt};
pub const DEFAULT_ANISETTE_V3_URL: &str = "https://ani.sidestore.io"; pub const DEFAULT_ANISETTE_V3_URL: &str = "https://ani.stikstore.app";
pub struct RemoteV3AnisetteProvider { pub struct RemoteV3AnisetteProvider {
pub state: Option<AnisetteState>, pub state: Option<AnisetteState>,
@@ -127,8 +127,7 @@ impl AnisetteProvider for RemoteV3AnisetteProvider {
Ok(data) Ok(data)
} }
AnisetteHeaders::GetHeadersError { message } => { AnisetteHeaders::GetHeadersError { message } => {
Err(report!("Failed to get anisette headers") Err(report!("Failed to get anisette headers").attach(message))
.attach(message))
} }
} }
} }

View File

@@ -0,0 +1,6 @@
pub struct CertificateIdentity {
pub machine_id: String,
pub machine_name: String,
}
impl CertificateIdentity {}

View File

@@ -8,6 +8,7 @@ use crate::dev::teams::TeamsApi;
use crate::dev::{developer_session::DeveloperSession, devices::DevicesApi}; use crate::dev::{developer_session::DeveloperSession, devices::DevicesApi};
use crate::util::device::IdeviceInfo; use crate::util::device::IdeviceInfo;
pub mod certificate;
pub mod config; pub mod config;
pub use config::{SideloadConfiguration, TeamSelection}; pub use config::{SideloadConfiguration, TeamSelection};
@@ -18,7 +19,6 @@ pub async fn sideload_app(
config: &SideloadConfiguration, config: &SideloadConfiguration,
) -> Result<(), Report> { ) -> Result<(), Report> {
let device_info = IdeviceInfo::from_device(device_provider).await?; let device_info = IdeviceInfo::from_device(device_provider).await?;
let teams = dev_session.list_teams().await?; let teams = dev_session.list_teams().await?;
let team = match teams.len() { let team = match teams.len() {
0 => { 0 => {

View File

View File

@@ -1,2 +1,5 @@
pub mod device; pub mod device;
#[cfg(feature = "keyring-storage")]
pub mod keyring_storage;
pub mod plist; pub mod plist;
pub mod storage;

View File

@@ -0,0 +1,21 @@
use base64::prelude::*;
use rootcause::prelude::*;
pub trait SideloadingStorage: Send + Sync {
fn store(&self, key: &str, value: &str) -> Result<(), Report>;
fn retrieve(&self, key: &str) -> Result<Option<String>, Report>;
fn store_data(&self, key: &str, value: &[u8]) -> Result<(), Report> {
let encoded = BASE64_STANDARD.encode(value);
self.store(key, &encoded)
}
fn retrieve_data(&self, key: &str) -> Result<Option<Vec<u8>>, Report> {
if let Some(encoded) = self.retrieve(key)? {
let decoded = BASE64_STANDARD.decode(&encoded)?;
Ok(Some(decoded))
} else {
Ok(None)
}
}
}