Skip to content

Commit

Permalink
Release 0.9.1, update deps, docs
Browse files Browse the repository at this point in the history
Bump dependencies to the latest released versions, edit the API
documentation slightly for clarity and grammar.
  • Loading branch information
nresare committed Feb 27, 2024
1 parent caebdd9 commit 0668b69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ssh-agent-client-rs"
version = "0.9.0"
version = "0.9.1"
license = "MIT OR Apache-2.0"
repository = "/~https://github.com/nresare/ssh-agent-client-rs"
description = """
Expand All @@ -12,8 +12,8 @@ edition = "2021"
bytes = "1.5.0"
ssh-key = { version = "0.6.4", features = ["crypto"] }
ssh-encoding = "0.2.0"
signature = "2.1.0"
thiserror = "1.0.49"
signature = "2.2.0"
thiserror = "1.0.57"

[dev-dependencies]
getrandom = "0.2.10"
getrandom = "0.2.12"
21 changes: 11 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! # ssh-agent-client-rs
//!
//! An ssh-agent client implementation in rust, aiming to provide a robust,
//! well tested and easy to use API to interact with an ssh-agent.
//! well tested and easy to use synchronous API to interact with an ssh-agent.
//!
//! # Examples
//! ```no_run
Expand Down Expand Up @@ -34,7 +34,7 @@ pub use self::error::Result;
/// A combination of the std::io::Read and std::io::Write traits.
pub trait ReadWrite: Read + Write {}

/// A Client instance is an object that can be used to interact with a ssh-agent,
/// A Client instance is an object that can be used to interact with an ssh-agent,
/// typically using a Unix socket
pub struct Client {
socket: Box<dyn ReadWrite>,
Expand All @@ -43,19 +43,19 @@ pub struct Client {
impl ReadWrite for UnixStream {}

impl Client {
/// Constructs a Client connected to a unix socket referenced by the path socket.
/// Constructs a Client connected to a unix socket referenced by path.
pub fn connect(path: &Path) -> Result<Client> {
let socket = Box::new(UnixStream::connect(path)?);
Ok(Client { socket })
}

/// Constructs a Client backed by an implementation of ReadWrite, mainly useful for
/// Construct a Client backed by an implementation of ReadWrite, mainly useful for
/// testing.
pub fn with_read_write(read_write: Box<dyn ReadWrite>) -> Client {
Client { socket: read_write }
}

/// Lists the identities that has been added to the connected ssh-agent.
/// List the identities that has been added to the connected ssh-agent.
pub fn list_identities(&mut self) -> Result<Vec<PublicKey>> {
write_message(&mut self.socket, WriteMessage::RequestIdentities)?;
match read_message(&mut self.socket)? {
Expand All @@ -64,26 +64,27 @@ impl Client {
}
}

/// Adds an identity to the connected ssh-agent.
/// Add an identity to the connected ssh-agent.
pub fn add_identity(&mut self, key: &PrivateKey) -> Result<()> {
write_message(&mut self.socket, WriteMessage::AddIdentity(key))?;
self.expect_success()
}

/// Removes an identity from the connected ssh-agent.
/// Remove an identity from the connected ssh-agent.
pub fn remove_identity(&mut self, key: &PrivateKey) -> Result<()> {
write_message(&mut self.socket, WriteMessage::RemoveIdentity(key))?;
self.expect_success()
}

/// Removes all identities from the connected ssh-agent.
/// Remove all identities from the connected ssh-agent.
pub fn remove_all_identities(&mut self) -> Result<()> {
write_message(&mut self.socket, WriteMessage::RemoveAllIdentities)?;
self.expect_success()
}

/// Sign bytes with the given public_key. For now, sign requests with RSA
/// keys are hard coded to use the SHA-512 hash algorithm.
/// Instruct the connected ssh-agent to sign data with the private key associated with the
/// provided public key. For now, sign requests with RSA keys are hard coded to use the
/// SHA-512 hashing algorithm.
pub fn sign(&mut self, key: &PublicKey, data: &[u8]) -> Result<Signature> {
write_message(&mut self.socket, WriteMessage::Sign(key, data))?;
match read_message(&mut self.socket)? {
Expand Down

0 comments on commit 0668b69

Please sign in to comment.