From d66f7e598b95e5b81caee1ff7fe7beca99be4f8f Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Sun, 23 Aug 2026 19:23:51 +0200 Subject: [PATCH] cli, crypto: Comment keys in SSH Agent To avoid confusion how the key ended up in SSH Agent, add a comment that adds some explanation. See also . --- crates/radicle-cli/src/commands/auth.rs | 12 ++++++++---- crates/radicle-crypto/src/ssh/agent.rs | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/radicle-cli/src/commands/auth.rs b/crates/radicle-cli/src/commands/auth.rs index 4caed9f02..6b01798e6 100644 --- a/crates/radicle-cli/src/commands/auth.rs +++ b/crates/radicle-cli/src/commands/auth.rs @@ -184,8 +184,9 @@ pub fn register( profile: &Profile, passphrase: crypto::ssh::Passphrase, ) -> anyhow::Result<()> { - let secret = profile - .keystore + let keystore = &profile.keystore; + let secret_key_path = keystore.secret_key_path(); + let secret = keystore .secret_key(Some(passphrase)) .map_err(|e| { if e.is_crypto_err() { @@ -194,9 +195,12 @@ pub fn register( e.into() } })? - .ok_or_else(|| anyhow!("Key not found in {:?}", profile.keystore.secret_key_path()))?; + .ok_or_else(|| anyhow!("Key not found in '{}'", secret_key_path.display()))?; - agent.register(&secret)?; + agent.register( + &secret, + format!("Radicle key loaded from '{}'.", secret_key_path.display()), + )?; Ok(()) } diff --git a/crates/radicle-crypto/src/ssh/agent.rs b/crates/radicle-crypto/src/ssh/agent.rs index 8d07ff1a2..f48b27f13 100644 --- a/crates/radicle-crypto/src/ssh/agent.rs +++ b/crates/radicle-crypto/src/ssh/agent.rs @@ -93,7 +93,7 @@ impl Agent { } /// Register a key with the agent. - pub fn register(&mut self, key: &SigningKey) -> Result<(), AgentError> { + pub fn register(&mut self, key: &SigningKey, comment: String) -> Result<(), AgentError> { use ssh_key::private::{Ed25519Keypair, KeypairData}; self.client.add_identity(proto::AddIdentity { credential: PrivateCredential::Key { @@ -103,7 +103,7 @@ impl Agent { ) .unwrap(), ), - comment: "".into(), + comment, }, }) }