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
30
31
32
use crate::Time;
use bstr::BStr;
mod decode;
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub struct Signature<'a> {
#[cfg_attr(feature = "serde1", serde(borrow))]
pub name: &'a BStr,
pub email: &'a BStr,
pub time: Time,
}
impl<'a> Signature<'a> {
pub fn from_bytes(data: &'a [u8]) -> Result<Signature<'a>, signature::decode::Error> {
decode::signature(data)
.map(|(_, t)| t)
.map_err(signature::decode::Error::from)
}
}
pub mod signature;