pub struct Config<Spawner = DefaultSpawner> { /* 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<DefaultSpawner>
impl Config<DefaultSpawner>
source§impl<Spawner> Config<Spawner>
impl<Spawner> Config<Spawner>
sourcepub fn new_with_spawner(spawner: Spawner) -> Self
pub fn new_with_spawner(spawner: Spawner) -> Self
Create a new config with the provided spawner
sourcepub fn set_host_header(self) -> Self
pub fn set_host_header(self) -> Self
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) -> Self
pub fn mastodon_compat(self) -> Self
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) -> Self
pub fn require_digest(self) -> Self
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) -> Self
pub fn dont_use_created_field(self) -> Self
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: Duration) -> Self
pub fn set_expiration(self, expiries_after: Duration) -> Self
Set the expiration to a custom duration
sourcepub fn require_header(self, header: &str) -> Self
pub fn require_header(self, header: &str) -> Self
Require a header on signed requests