pub struct AgentClient<S: AgentStream> { /* private fields */ }Expand description
SSH agent client.
Implementations§
Source§impl<S: AgentStream + Send + Unpin + 'static> AgentClient<S>
impl<S: AgentStream + Send + Unpin + 'static> AgentClient<S>
Sourcepub fn dynamic(
self,
) -> AgentClient<Box<dyn AgentStream + Send + Unpin + 'static>>
pub fn dynamic( self, ) -> AgentClient<Box<dyn AgentStream + Send + Unpin + 'static>>
Wraps the internal stream in a Box
pub fn into_inner(self) -> Box<dyn AgentStream + Send + Unpin + 'static>
Source§impl<S: AgentStream + Unpin> AgentClient<S>
impl<S: AgentStream + 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>
Connect 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>
Connect to an SSH agent specified by the SSH_AUTH_SOCK environment variable.
Source§impl<S: AgentStream + Unpin> AgentClient<S>
impl<S: AgentStream + Unpin> AgentClient<S>
Sourcepub async fn add_identity(
&mut self,
key: &PrivateKey,
constraints: &[Constraint],
) -> Result<(), Error>
pub async fn add_identity( &mut self, key: &PrivateKey, 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 async fn sign_request(
&mut self,
public: &PublicKey,
hash_alg: Option<HashAlg>,
data: CryptoVec,
) -> Result<CryptoVec, Error>
pub async fn sign_request( &mut self, public: &PublicKey, hash_alg: Option<HashAlg>, data: CryptoVec, ) -> Result<CryptoVec, Error>
Ask the agent to sign the supplied piece of data.
Sourcepub fn sign_request_base64(
self,
public: &PublicKey,
hash_alg: Option<HashAlg>,
data: &[u8],
) -> impl Future<Output = (Self, Result<String, Error>)>
pub fn sign_request_base64( self, public: &PublicKey, hash_alg: Option<HashAlg>, data: &[u8], ) -> impl Future<Output = (Self, Result<String, Error>)>
Ask the agent to sign the supplied piece of data.
Sourcepub async fn sign_request_signature(
&mut self,
public: &PublicKey,
hash_alg: Option<HashAlg>,
data: &[u8],
) -> Result<Signature, Error>
pub async fn sign_request_signature( &mut self, public: &PublicKey, hash_alg: Option<HashAlg>, data: &[u8], ) -> 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.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for AgentClient<S>where
S: Freeze,
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> UnsafeUnpin for AgentClient<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for AgentClient<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more