pub struct SignatureConfig { /* 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
pub fn new() -> Config
Sourcepub fn set_host_header(self) -> Config
pub fn set_host_header(self) -> Config
This method can be used to include the Host header in the HTTP Signature without interfering with Reqwest’s built-in Host mechanisms
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 enabling this, the Date header becomes required on requests. This is to prevent replay attacks
Sourcepub fn set_expiration(self, expiries_after: TimeDelta) -> Config
pub fn set_expiration(self, expiries_after: TimeDelta) -> Config
Set the expiration to a custom duration
Sourcepub fn require_header(self, header: &str) -> Config
pub fn require_header(self, header: &str) -> Config
Require a header on signed requests