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, }, }) }