Struct thrussh_keys::agent::client::AgentClient
source · pub struct AgentClient<S: AsyncRead + AsyncWrite> { /* private fields */ }
Expand description
SSH agent client.
Implementations§
source§impl<S: AsyncRead + AsyncWrite + Unpin> AgentClient<S>
impl<S: AsyncRead + AsyncWrite + Unpin> AgentClient<S>
source§impl AgentClient<UnixStream>
impl AgentClient<UnixStream>
sourcepub async fn connect_uds<P: AsRef<Path>>(path: P) -> Result<Self, Error>
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).
sourcepub async fn connect_env() -> Result<Self, Error>
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>
impl<S: AsyncRead + AsyncWrite + Unpin> AgentClient<S>
sourcepub async fn add_identity(
&mut self,
key: &KeyPair,
constraints: &[Constraint]
) -> Result<(), Error>
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.
sourcepub async fn add_smartcard_key(
&mut self,
id: &str,
pin: &[u8],
constraints: &[Constraint]
) -> Result<(), Error>
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.
sourcepub async fn lock(&mut self, passphrase: &[u8]) -> Result<(), Error>
pub async fn lock(&mut self, passphrase: &[u8]) -> Result<(), Error>
Lock the agent, making it refuse to sign until unlocked.
sourcepub async fn unlock(&mut self, passphrase: &[u8]) -> Result<(), Error>
pub async fn unlock(&mut self, passphrase: &[u8]) -> Result<(), Error>
Unlock the agent, allowing it to sign again.
sourcepub async fn request_identities(&mut self) -> Result<Vec<PublicKey>, Error>
pub async fn request_identities(&mut self) -> Result<Vec<PublicKey>, Error>
Ask the agent for a list of the currently registered secret keys.
sourcepub fn sign_request(
self,
public: &PublicKey,
data: CryptoVec
) -> impl Future<Output = (Self, Result<CryptoVec, Error>)>
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.
sourcepub fn sign_request_base64(
self,
public: &PublicKey,
data: &[u8]
) -> impl Future<Output = (Self, Result<String, Error>)>
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.
sourcepub fn sign_request_signature(
self,
public: &PublicKey,
data: &[u8]
) -> impl Future<Output = (Self, Result<Signature, Error>)>
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
.
sourcepub async fn remove_identity(&mut self, public: &PublicKey) -> Result<(), Error>
pub async fn remove_identity(&mut self, public: &PublicKey) -> Result<(), Error>
Ask the agent to remove a key from its memory.
sourcepub async fn remove_smartcard_key(
&mut self,
id: &str,
pin: &[u8]
) -> Result<(), Error>
pub async fn remove_smartcard_key( &mut self, id: &str, pin: &[u8] ) -> Result<(), Error>
Ask the agent to remove a smartcard from its memory.
sourcepub async fn remove_all_identities(&mut self) -> Result<(), Error>
pub async fn remove_all_identities(&mut self) -> Result<(), Error>
Ask the agent to forget all known keys.