From eebd91f9c9814cfeb056cf24a867590b51a2ac5d Mon Sep 17 00:00:00 2001 From: neuronull <9162534+neuronull@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:09:25 -0600 Subject: [PATCH] fix set_keys callsite --- apps/desktop/desktop_native/core/src/ssh_agent/mod.rs | 9 ++++++--- apps/desktop/desktop_native/napi/src/lib.rs | 11 +++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/desktop/desktop_native/core/src/ssh_agent/mod.rs b/apps/desktop/desktop_native/core/src/ssh_agent/mod.rs index 98afd8d76fe..3734db085cc 100644 --- a/apps/desktop/desktop_native/core/src/ssh_agent/mod.rs +++ b/apps/desktop/desktop_native/core/src/ssh_agent/mod.rs @@ -208,7 +208,10 @@ impl BitwardenDesktopAgent { /// /// This function panics if the underlying `RwLock` is poisoned or /// if the cipher's public key is not serializable to bytes. - pub fn set_keys(&mut self, new_keys: &[(String, String, String)]) -> Result<(), anyhow::Error> { + pub fn set_keys( + &mut self, + new_keys: &[(&String, &String, &String)], + ) -> Result<(), anyhow::Error> { if !self.is_running() { return Err(anyhow::anyhow!( "[BitwardenDesktopAgent] Tried to set keys while agent is not running" @@ -232,8 +235,8 @@ impl BitwardenDesktopAgent { public_key_bytes, BitwardenSshKey { private_key: Some(private_key), - name: name.clone(), - cipher_uuid: cipher_id.clone(), + name: (*name).to_string(), + cipher_uuid: (*cipher_id).to_string(), }, ); } diff --git a/apps/desktop/desktop_native/napi/src/lib.rs b/apps/desktop/desktop_native/napi/src/lib.rs index ff38581dab6..5b37b11d9aa 100644 --- a/apps/desktop/desktop_native/napi/src/lib.rs +++ b/apps/desktop/desktop_native/napi/src/lib.rs @@ -291,14 +291,13 @@ pub mod sshagent { agent_state: &mut SshAgentState, new_keys: Vec, ) -> napi::Result<()> { + let keys: Vec<_> = new_keys + .iter() + .map(|k| (&k.private_key, &k.name, &k.cipher_id)) + .collect(); let bitwarden_agent_state = &mut agent_state.state; bitwarden_agent_state - .set_keys( - new_keys - .iter() - .map(|k| (k.private_key.clone(), k.name.clone(), k.cipher_id.clone())) - .collect(), - ) + .set_keys(&keys) .map_err(|e| napi::Error::from_reason(e.to_string()))?; Ok(()) }