1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#[macro_use]
mod error;
mod http_connector;
mod status;
use std::fmt::{Debug, Display};
use uuid::Uuid;
pub use self::error::{ConnectorError, ConnectorErrorKind};
pub use self::http_connector::{HttpConfig, HttpConnector};
pub use self::status::Status;
pub const USER_AGENT: &str = concat!("yubihsm.rs ", env!("CARGO_PKG_VERSION"));
pub trait Connector: Sized + Send + Sync {
type Config: Debug + Default + Display;
fn open(config: Self::Config) -> Result<Self, ConnectorError>;
fn status(&self) -> Result<Status, ConnectorError>;
fn send_command(&self, uuid: Uuid, cmd: Vec<u8>) -> Result<Vec<u8>, ConnectorError>;
}