(BREAKING) implement host name parameter for lockdown pair

This commit is contained in:
Jackson Coxson
2026-02-06 16:45:27 -07:00
parent 496e099187
commit 38a3a558b5
2 changed files with 13 additions and 2 deletions

View File

@@ -260,6 +260,7 @@ impl LockdownClient {
&mut self, &mut self,
host_id: impl Into<String>, host_id: impl Into<String>,
system_buid: impl Into<String>, system_buid: impl Into<String>,
host_name: Option<&str>,
) -> Result<crate::pairing_file::PairingFile, IdeviceError> { ) -> Result<crate::pairing_file::PairingFile, IdeviceError> {
let host_id = host_id.into(); let host_id = host_id.into();
let system_buid = system_buid.into(); let system_buid = system_buid.into();
@@ -297,6 +298,7 @@ impl LockdownClient {
let req = crate::plist!({ let req = crate::plist!({
"Label": self.idevice.label.clone(), "Label": self.idevice.label.clone(),
"Request": "Pair", "Request": "Pair",
"HostName":? host_name,
"PairRecord": pair_record.clone(), "PairRecord": pair_record.clone(),
"ProtocolVersion": "2", "ProtocolVersion": "2",
"PairingOptions": { "PairingOptions": {

View File

@@ -6,12 +6,18 @@ use idevice::{
provider::IdeviceProvider, provider::IdeviceProvider,
usbmuxd::{Connection, UsbmuxdAddr, UsbmuxdConnection}, usbmuxd::{Connection, UsbmuxdAddr, UsbmuxdConnection},
}; };
use jkcli::{CollectedArguments, JkArgument, JkCommand}; use jkcli::{CollectedArguments, JkArgument, JkCommand, JkFlag};
pub fn register() -> JkCommand { pub fn register() -> JkCommand {
JkCommand::new() JkCommand::new()
.help("Manage files in the AFC jail of a device") .help("Manage files in the AFC jail of a device")
.with_argument(JkArgument::new().with_help("A UDID to override and pair with")) .with_argument(JkArgument::new().with_help("A UDID to override and pair with"))
.with_flag(
JkFlag::new("name")
.with_help("The host name to report to the device")
.with_argument(JkArgument::new().required(true))
.with_short("n"),
)
} }
pub async fn main(arguments: &CollectedArguments, _provider: Box<dyn IdeviceProvider>) { pub async fn main(arguments: &CollectedArguments, _provider: Box<dyn IdeviceProvider>) {
@@ -45,8 +51,11 @@ pub async fn main(arguments: &CollectedArguments, _provider: Box<dyn IdeviceProv
}; };
let id = uuid::Uuid::new_v4().to_string().to_uppercase(); let id = uuid::Uuid::new_v4().to_string().to_uppercase();
let name = arguments.get_flag::<String>("name");
let name = name.as_deref();
let mut pairing_file = lockdown_client let mut pairing_file = lockdown_client
.pair(id, u.get_buid().await.unwrap()) .pair(id, u.get_buid().await.unwrap(), name)
.await .await
.expect("Failed to pair"); .expect("Failed to pair");