HttpSignatureParams

Struct HttpSignatureParams 

Source
pub struct HttpSignatureParams {
    pub created: Option<u64>,
    pub expires: Option<u64>,
    pub nonce: Option<String>,
    pub alg: Option<String>,
    pub keyid: Option<String>,
    pub tag: Option<String>,
    pub covered_components: Vec<HttpMessageComponentId>,
}
Expand description

Struct defining Http message signature parameters https://datatracker.ietf.org/doc/html/rfc9421#name-signature-parameters

Fields§

§created: Option<u64>

created unix timestamp.

§expires: Option<u64>

signature expires unix timestamp.

§nonce: Option<String>

nonce

§alg: Option<String>

algorithm name

§keyid: Option<String>

key id.

§tag: Option<String>

tag

§covered_components: Vec<HttpMessageComponentId>

covered component vector string: ordered message components, i.e., string of http_fields and derived_components

Implementations§

Source§

impl HttpSignatureParams

Source

pub fn try_new( covered_components: &[HttpMessageComponentId], ) -> Result<HttpSignatureParams, HttpSigError>

Create new HttpSignatureParams object for the given covered components only with `created`` current timestamp.

Source

pub fn set_created(&mut self, created: u64) -> &mut HttpSignatureParams

Set artificial created timestamp

Source

pub fn set_expires(&mut self, expires: u64) -> &mut HttpSignatureParams

Set expires timestamp

Source

pub fn set_nonce(&mut self, nonce: &str) -> &mut HttpSignatureParams

Set nonce

Source

pub fn set_alg(&mut self, alg: &AlgorithmName) -> &mut HttpSignatureParams

Set alg

Source

pub fn set_keyid(&mut self, keyid: &str) -> &mut HttpSignatureParams

Set keyid

Source

pub fn set_tag(&mut self, tag: &str) -> &mut HttpSignatureParams

Set tag

Source

pub fn set_key_info( &mut self, key: &impl SigningKey, ) -> &mut HttpSignatureParams

Set keyid and alg from the signing key

Source

pub fn set_random_nonce(&mut self) -> &mut HttpSignatureParams

Set random nonce

Source

pub fn set_expires_with_duration( &mut self, duration_secs: Option<u64>, ) -> &mut HttpSignatureParams

Set expires timestamp from the current timestamp

Source

pub fn is_expired(&self) -> bool

Check if the signature params is expired if exp field is present. If exp field is not present, it always returns false.

Trait Implementations§

Source§

impl Clone for HttpSignatureParams

Source§

fn clone(&self) -> HttpSignatureParams

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpSignatureParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for HttpSignatureParams

Source§

fn default() -> HttpSignatureParams

Returns the “default value” for a type. Read more
Source§

impl Display for HttpSignatureParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl TryFrom<&ListEntry> for HttpSignatureParams

Source§

fn try_from(value: &ListEntry) -> Result<HttpSignatureParams, HttpSigError>

Convert from ListEntry to HttpSignatureParams

Source§

type Error = HttpSigError

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

impl TryFrom<&str> for HttpSignatureParams

Source§

fn try_from(value: &str) -> Result<HttpSignatureParams, HttpSigError>

Convert from string to HttpSignatureParams

Source§

type Error = HttpSigError

The type returned in the event of a conversion error.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more