rustsec/repository/signature.rs
1//! Git commit signatures
2
3use crate::error::Error;
4
5/// Digital signatures (in OpenPGP format) on commits to the repository
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub struct Signature(Vec<u8>);
8
9impl Signature {
10 /// Parse a signature from a Git commit
11 pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error> {
12 // TODO: actually verify the signature is well-structured
13 Ok(Signature(bytes.into()))
14 }
15}
16
17impl AsRef<[u8]> for Signature {
18 fn as_ref(&self) -> &[u8] {
19 self.0.as_ref()
20 }
21}