ssh_agent/proto/
mod.rs

1pub mod ser;
2pub mod de;
3
4#[macro_use]
5pub mod key_type;
6pub mod private_key;
7pub mod public_key;
8pub mod signature;
9pub mod message;
10pub mod error;
11
12#[cfg(test)]
13mod tests;
14
15pub use self::ser::to_bytes;
16pub use self::de::from_bytes;
17
18pub use self::key_type::*;
19pub use self::private_key::*;
20pub use self::public_key::*;
21pub use self::signature::*;
22pub use self::message::*;
23pub use self::error::*;
24
25use serde::{Serialize, Deserialize};
26
27pub trait Blob: Sized {
28    fn to_blob(&self) -> ProtoResult<Vec<u8>>;
29    fn from_blob(blob: &[u8]) -> ProtoResult<Self>;
30}
31
32impl<'a, T: Serialize + Deserialize<'a>> Blob for T {
33    fn to_blob(&self) -> ProtoResult<Vec<u8>> {
34        to_bytes(self)
35    }
36    
37    fn from_blob(blob: &[u8]) -> ProtoResult<T> {
38        from_bytes(blob)
39    }
40}