pam_ssh_agent/
agent.rs

1use ssh_agent_client_rs::{Client, Identity, Result};
2use ssh_key::Signature;
3
4/// A small trait defining the two methods of ssh_agent_client_rs::Client to simplify testing
5pub trait SSHAgent {
6    fn list_identities(&mut self) -> Result<Vec<Identity<'static>>>;
7    fn sign<'a>(&mut self, key: impl Into<Identity<'a>>, data: &[u8]) -> Result<Signature>;
8}
9
10impl SSHAgent for Client {
11    fn list_identities(&mut self) -> Result<Vec<Identity<'static>>> {
12        self.list_all_identities()
13    }
14    fn sign<'a>(&mut self, key: impl Into<Identity<'a>>, data: &[u8]) -> Result<Signature> {
15        self.sign(key, data)
16    }
17}