pub struct Config { /* private fields */ }
Expand description
Configuration for signing and verifying signatures
By default, the config is set up to create and verify signatures that expire after 10
seconds, and use the (created)
and (expires)
fields that were introduced in draft 11
Implementations§
Source§impl Config
impl Config
Sourcepub fn mastodon_compat(self) -> Config
pub fn mastodon_compat(self) -> Config
Enable mastodon compatibility
This is the same as disabling the use of (created)
and (expires)
signature fields,
requiring the Date header, and requiring the Host header
Sourcepub fn require_digest(self) -> Config
pub fn require_digest(self) -> Config
Require the Digest header be set
This is useful for POST, PUT, and PATCH requests, but doesn’t make sense for GET or DELETE.
Sourcepub fn dont_use_created_field(self) -> Config
pub fn dont_use_created_field(self) -> Config
Opt out of using the (created) and (expires) fields introduced in draft 11
Note that by not requiring the created field, the Date header becomes required. This is to prevent replay attacks.
Sourcepub const fn set_expiration(self, expires_after: Duration) -> Config
pub const fn set_expiration(self, expires_after: Duration) -> Config
Set the expiration to a custom duration
Sourcepub fn require_header(self, header: &str) -> Config
pub fn require_header(self, header: &str) -> Config
Mark a header as required
Sourcepub fn begin_sign(
&self,
method: &str,
path_and_query: &str,
headers: BTreeMap<String, String>,
) -> Result<Unsigned, RequiredError>
pub fn begin_sign( &self, method: &str, path_and_query: &str, headers: BTreeMap<String, String>, ) -> Result<Unsigned, RequiredError>
Perform the neccessary operations to produce an Unsigned
type, which can be used to
sign the header
Sourcepub fn begin_verify(
&self,
method: &str,
path_and_query: &str,
headers: BTreeMap<String, String>,
) -> Result<Unverified, PrepareVerifyError>
pub fn begin_verify( &self, method: &str, path_and_query: &str, headers: BTreeMap<String, String>, ) -> Result<Unverified, PrepareVerifyError>
Perform the neccessary operations to produce and Unverified
type, which can be used to
verify the header
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more