Expand description
Blocking SSH-agent client.
Wraps ssh_agent_lib::blocking::Client with a Gitway-native error
surface and a small convenience API: connect, add, list, remove,
remove_all, lock, unlock.
The blocking API is chosen deliberately — an ssh-add-style binary has
no use for async concurrency, and avoiding tokio here keeps the
dependency graph small.
§Cross-platform transport
On Unix the client connects to the Unix domain socket at
$SSH_AUTH_SOCK via std::os::unix::net::UnixStream. On Windows
the same env var conventionally carries a named-pipe path (OpenSSH
for Windows uses \\.\pipe\openssh-ssh-agent); we open that with
[std::fs::OpenOptions::read(true).write(true).open(path)], which
gives us a Read + Write handle that drives ssh_agent_lib’s
transport exactly the same way.
§Examples
use std::path::Path;
use anvil_ssh::agent::client::Agent;
let mut agent = Agent::from_env()?;
agent.list()?.iter().for_each(|id| println!("{}", id.fingerprint));§Errors
Every operation returns AnvilError. Agent-protocol failures and
I/O failures are both folded into the Io variant with a descriptive
message; callers that care can match via AnvilError::is_io.
§Zeroization
ssh-agent-lib 0.5.2’s lock / unlock take a plain String by
value, so the passphrase copy inside the library cannot be cleared on
our behalf. Callers supply a Zeroizing<String> and this module
clones only the byte contents into the library’s expected String
argument; the caller’s original buffer remains zeroizable.