Skip to main content

AgentClient

Struct AgentClient 

Source
pub struct AgentClient<S: AgentStream> { /* private fields */ }
Expand description

SSH agent client.

Implementations§

Source§

impl<S: AgentStream + Send + Unpin + 'static> AgentClient<S>

Source

pub fn dynamic( self, ) -> AgentClient<Box<dyn AgentStream + Send + Unpin + 'static>>

Wraps the internal stream in a Box, allowing different client implementations to have the same type

Source

pub fn into_inner(self) -> Box<dyn AgentStream + Send + Unpin + 'static>

Source§

impl<S: AgentStream + 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>

Connect to an SSH agent via the provided stream (on Unix, usually a Unix-domain socket).

Source

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>

Source

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.

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

Source

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.

Source

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.

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.

Trait Implementations§

Source§

impl<R: AsyncRead + AsyncWrite + Unpin + Send + 'static> Signer for AgentClient<R>

Source§

type Error = AgentAuthError

Source§

fn auth_publickey_sign( &mut self, key: &PublicKey, hash_alg: Option<HashAlg>, to_sign: CryptoVec, ) -> impl Future<Output = Result<CryptoVec, Self::Error>>

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> 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> Classify for T

Source§

type Classified = T

Source§

fn classify(self) -> T

Source§

impl<T> Declassify for T

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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