Skip to main content

UnsignedPayload

Struct UnsignedPayload 

Source
pub struct UnsignedPayload {
    pub timestamp: SystemTime,
    pub message_hash: Hash,
    pub message_length: u64,
    pub app_metadata: Vec<u8>,
}
Expand description

Passed to Sulid::sign to create an sULID.

Fields§

§timestamp: SystemTime

The timestamp portion of the sULID will be based on this. It is also part of the signed payload, to prevent tampering after signing.

§message_hash: Hash

A hash of the message being signed.

§message_length: u64

The length of the content being signed, in bytes.

§app_metadata: Vec<u8>

For basic use, you may leave this field empty.

You may optionally add extra, application-specific metadata to the signed payload. This is useful if you want to make sure this data can be read and verified along with the sULID before the main content is fetched/validated/displayed.

As an example, you may want to include a Content-Type style header to distinguish different types of signed content.

You might also want to include an application-specific marker to distinguish signatures in that context from other signatures.

Note that this crate makes no requriements of app_metadata other than that you must be able to reproduce it to verify an sULID. Make sure any data included here has a canonical form, so that you can reproduce it reliably.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.