Struct Client

Source
pub struct Client { /* private fields */ }
Expand description

A Client instance is an object that can be used to interact with an ssh-agent, typically using a Unix socket

Implementations§

Source§

impl Client

Source

pub fn connect(path: &Path) -> Result<Client>

Constructs a Client connected to a unix socket referenced by path.

Source

pub fn with_read_write(read_write: Box<dyn ReadWrite>) -> Client

Construct a Client backed by an implementation of ReadWrite, mainly useful for testing.

Source

pub fn list_identities(&mut self) -> Result<Vec<PublicKey>>

List the identities that has been added to the connected ssh-agent.

Source

pub fn add_identity(&mut self, key: &PrivateKey) -> Result<()>

Add an identity to the connected ssh-agent.

Source

pub fn remove_identity(&mut self, key: &PrivateKey) -> Result<()>

Remove an identity from the connected ssh-agent.

Source

pub fn remove_all_identities(&mut self) -> Result<()>

Remove all identities from the connected ssh-agent.

Source

pub fn sign(&mut self, key: &PublicKey, data: &[u8]) -> Result<Signature>

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.

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl !Send for Client

§

impl !Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V