pub struct AgentClient<S: AsyncRead + AsyncWrite> { /* private fields */ }
Expand description

SSH agent client.

Implementations§

source§

impl<S: AsyncRead + AsyncWrite + Unpin> AgentClient<S>

source

pub fn connect(stream: S) -> Self

Build a future that connects to an SSH agent via the provided stream (on Unix, usually a Unix-domain socket).

source§

impl AgentClient<UnixStream>

source

pub async fn connect_uds<P: AsRef<Path>>(path: P) -> Result<Self, Error>

Build a future that connects to an SSH agent via the provided stream (on Unix, usually a Unix-domain socket).

source

pub async fn connect_env() -> Result<Self, Error>

Build a future that connects to an SSH agent via the provided stream (on Unix, usually a Unix-domain socket).

source§

impl<S: AsyncRead + AsyncWrite + Unpin> AgentClient<S>

source

pub async fn add_identity( &mut self, key: &KeyPair, constraints: &[Constraint] ) -> Result<(), Error>

Send a key to the agent, with a (possibly empty) slice of constraints to apply when using the key to sign.

source

pub async fn add_smartcard_key( &mut self, id: &str, pin: &[u8], constraints: &[Constraint] ) -> Result<(), Error>

Add a smart card to the agent, with a (possibly empty) set of constraints to apply when signing.

source

pub async fn lock(&mut self, passphrase: &[u8]) -> Result<(), Error>

Lock the agent, making it refuse to sign until unlocked.

source

pub async fn unlock(&mut self, passphrase: &[u8]) -> Result<(), Error>

Unlock the agent, allowing it to sign again.

source

pub async fn request_identities(&mut self) -> Result<Vec<PublicKey>, Error>

Ask the agent for a list of the currently registered secret keys.

source

pub fn sign_request( self, public: &PublicKey, data: CryptoVec ) -> impl Future<Output = (Self, Result<CryptoVec, Error>)>

Ask the agent to sign the supplied piece of data.

source

pub fn sign_request_base64( self, public: &PublicKey, data: &[u8] ) -> impl Future<Output = (Self, Result<String, Error>)>

Ask the agent to sign the supplied piece of data.

source

pub fn sign_request_signature( self, public: &PublicKey, data: &[u8] ) -> impl Future<Output = (Self, Result<Signature, Error>)>

Ask the agent to sign the supplied piece of data, and return a Signature.

source

pub async fn remove_identity(&mut self, public: &PublicKey) -> Result<(), Error>

Ask the agent to remove a key from its memory.

source

pub async fn remove_smartcard_key( &mut self, id: &str, pin: &[u8] ) -> Result<(), Error>

Ask the agent to remove a smartcard from its memory.

source

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

Ask the agent to forget all known keys.

source

pub async fn extension(&mut self, typ: &[u8], ext: &[u8]) -> Result<(), Error>

Send a custom message to the agent.

source

pub async fn query_extension( &mut self, typ: &[u8], ext: CryptoVec ) -> Result<bool, Error>

Ask the agent what extensions about supported extensions.

Auto Trait Implementations§

§

impl<S> RefUnwindSafe for AgentClient<S>where S: RefUnwindSafe,

§

impl<S> Send for AgentClient<S>where S: Send,

§

impl<S> Sync for AgentClient<S>where S: Sync,

§

impl<S> Unpin for AgentClient<S>where S: Unpin,

§

impl<S> UnwindSafe for AgentClient<S>where S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V