From a12f873407e33ec73f4b567c23905dd9ce44f2f8 Mon Sep 17 00:00:00 2001 From: "Mike A." Date: Tue, 5 May 2026 20:18:19 +0200 Subject: [PATCH] Allow instantiation of KeychainClientState with manual host --- src/icloud/keychain.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/icloud/keychain.rs b/src/icloud/keychain.rs index c8afb85..69578e4 100644 --- a/src/icloud/keychain.rs +++ b/src/icloud/keychain.rs @@ -1040,17 +1040,23 @@ pub struct KeychainClientState { impl KeychainClientState { pub fn new(dsid: String, adsid: String, delegate: &MobileMeDelegateResponse) -> Option { - Some(KeychainClientState { + let host = delegate.config.get("com.apple.Dataclass.KeychainSync")?.as_dictionary().unwrap().get("escrowProxyUrl")?.as_string().unwrap().to_string(); + + Some(Self::new_with_host(dsid, adsid, host)) + } + + pub fn new_with_host(dsid: String, adsid: String, host: String) -> KeychainClientState { + KeychainClientState { dsid, adsid, - host: delegate.config.get("com.apple.Dataclass.KeychainSync")?.as_dictionary().unwrap().get("escrowProxyUrl")?.as_string().unwrap().to_string(), + host, state_token: None, state: HashMap::new(), user_identity: None, current_bottle: None, keystore: KeychainKeyStore(vec![]), items: HashMap::new(), - }) + } } // filter out custodian recovery keys