Skip to content

Commit a12f873

Browse files
committed
Allow instantiation of KeychainClientState with manual host
1 parent b2996d5 commit a12f873

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/icloud/keychain.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,17 +1040,23 @@ pub struct KeychainClientState {
10401040

10411041
impl KeychainClientState {
10421042
pub fn new(dsid: String, adsid: String, delegate: &MobileMeDelegateResponse) -> Option<KeychainClientState> {
1043-
Some(KeychainClientState {
1043+
let host = delegate.config.get("com.apple.Dataclass.KeychainSync")?.as_dictionary().unwrap().get("escrowProxyUrl")?.as_string().unwrap().to_string();
1044+
1045+
Some(Self::new_with_host(dsid, adsid, host))
1046+
}
1047+
1048+
pub fn new_with_host(dsid: String, adsid: String, host: String) -> KeychainClientState {
1049+
KeychainClientState {
10441050
dsid,
10451051
adsid,
1046-
host: delegate.config.get("com.apple.Dataclass.KeychainSync")?.as_dictionary().unwrap().get("escrowProxyUrl")?.as_string().unwrap().to_string(),
1052+
host,
10471053
state_token: None,
10481054
state: HashMap::new(),
10491055
user_identity: None,
10501056
current_bottle: None,
10511057
keystore: KeychainKeyStore(vec![]),
10521058
items: HashMap::new(),
1053-
})
1059+
}
10541060
}
10551061

10561062
// filter out custodian recovery keys

0 commit comments

Comments
 (0)