pub struct Signature {
pub algorithm: SignatureAlgorithm,
pub format: SignatureFormat,
pub data: Vec<u8>,
pub key_id: Option<String>,
pub created_at: Option<u64>,
pub expires_at: Option<u64>,
}Expand description
A digital signature.
Fields§
§algorithm: SignatureAlgorithmThe signature algorithm
format: SignatureFormatThe signature format
data: Vec<u8>The signature data
key_id: Option<String>Optional identifier of the key used
created_at: Option<u64>Timestamp when signature was created (Unix timestamp)
expires_at: Option<u64>Timestamp when signature expires (Unix timestamp)
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn new(
algorithm: SignatureAlgorithm,
format: SignatureFormat,
data: Vec<u8>,
) -> Self
pub fn new( algorithm: SignatureAlgorithm, format: SignatureFormat, data: Vec<u8>, ) -> Self
Create a new signature.
Sourcepub fn with_key_id(self, key_id: String) -> Self
pub fn with_key_id(self, key_id: String) -> Self
Set the key identifier.
Sourcepub fn with_created_at(self, created_at: u64) -> Self
pub fn with_created_at(self, created_at: u64) -> Self
Set the creation timestamp.
Sourcepub fn with_expires_at(self, expires_at: u64) -> Self
pub fn with_expires_at(self, expires_at: u64) -> Self
Set the expiration timestamp.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the signature has expired.
Sourcepub fn decode_data(&self) -> Result<Vec<u8>>
pub fn decode_data(&self) -> Result<Vec<u8>>
Decode the signature data based on its format.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnsafeUnpin for Signature
impl UnwindSafe for Signature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more