Struct http_sig::SigningConfig
source · pub struct SigningConfig { /* private fields */ }
Expand description
The configuration used for signing HTTP requests.
Implementations§
source§impl SigningConfig
impl SigningConfig
sourcepub fn new_default(key_id: &str, key: &[u8]) -> Self
pub fn new_default(key_id: &str, key: &[u8]) -> Self
Creates a new signing configuration using the default signature algorithm, and the specified key ID and key.
sourcepub fn new<SigAlg: HttpSignatureSign>(key_id: &str, signature: SigAlg) -> Self
pub fn new<SigAlg: HttpSignatureSign>(key_id: &str, signature: SigAlg) -> Self
Creates a new signing configuration using a custom signature algorithm, and the specified key ID.
sourcepub fn digest(&self) -> &dyn HttpDigest
pub fn digest(&self) -> &dyn HttpDigest
Returns the HTTP digest algorithm.
sourcepub fn with_digest<DigestAlg: HttpDigest>(self, digest: DigestAlg) -> Self
pub fn with_digest<DigestAlg: HttpDigest>(self, digest: DigestAlg) -> Self
Sets the HTTP digest algorithm.
sourcepub fn compute_digest(&self) -> bool
pub fn compute_digest(&self) -> bool
Returns whether the digest will be automatically computed when not already present.
This is set to true
by default.
sourcepub fn set_compute_digest(&mut self, compute_digest: bool) -> &mut Self
pub fn set_compute_digest(&mut self, compute_digest: bool) -> &mut Self
Controls whether the digest will be automatically computed when not already present (in-place).
This is set to true
by default.
sourcepub fn with_compute_digest(self, compute_digest: bool) -> Self
pub fn with_compute_digest(self, compute_digest: bool) -> Self
Controls whether the digest will be automatically computed when not already present.
This is set to true
by default.
sourcepub fn add_date(&self) -> bool
pub fn add_date(&self) -> bool
Returns whether the current date and time will be added to the request when not already present.
This is set to true
by default.
sourcepub fn set_add_date(&mut self, add_date: bool) -> &mut Self
pub fn set_add_date(&mut self, add_date: bool) -> &mut Self
Controls whether the current date and time will be added to the request when not already present (in-place).
This is set to true
by default.
sourcepub fn with_add_date(self, add_date: bool) -> Self
pub fn with_add_date(self, add_date: bool) -> Self
Controls whether the current date and time will be added to the request when not already present.
This is set to true
by default.
sourcepub fn add_host(&self) -> bool
pub fn add_host(&self) -> bool
Returns whether the host will be added to the request when not already present.
This is set to true
by default.
sourcepub fn set_add_host(&mut self, add_host: bool) -> &mut Self
pub fn set_add_host(&mut self, add_host: bool) -> &mut Self
Controls whether the host will be added to the request when not already present (in-place).
This is set to true
by default.
sourcepub fn with_add_host(self, add_host: bool) -> Self
pub fn with_add_host(self, add_host: bool) -> Self
Controls whether the host will be added to the request when not already present.
This is set to true
by default.
sourcepub fn headers(&self) -> impl IntoIterator<Item = &Header>
pub fn headers(&self) -> impl IntoIterator<Item = &Header>
Returns the list of headers to include in the signature. Headers in this list which are not present in the request itself will be skipped when signing the request.
This list contains (request-target)
, host
, date
and digest
by default.
sourcepub fn set_headers(&mut self, headers: &[Header]) -> &mut Self
pub fn set_headers(&mut self, headers: &[Header]) -> &mut Self
Controls the list of headers to include in the signature (in-place). Headers in this list which are not present in the request itself will be skipped when signing the request.
This list contains (request-target)
, host
, date
and digest
by default.
sourcepub fn with_headers(self, headers: &[Header]) -> Self
pub fn with_headers(self, headers: &[Header]) -> Self
Controls the list of headers to include in the signature. Headers in this list which are not present in the request itself will be skipped when signing the request.
This list contains (request-target)
, host
, date
and digest
by default.
sourcepub fn skip_missing(&self) -> bool
pub fn skip_missing(&self) -> bool
Returns whether the missing headers will be skipped when not present, or if signing will fail instead.
This is set to true
by default.
sourcepub fn set_skip_missing(&mut self, skip_missing: bool) -> &mut Self
pub fn set_skip_missing(&mut self, skip_missing: bool) -> &mut Self
Controls whether the missing headers will be skipped when not present, or if signing will fail instead.
This is set to true
by default.
sourcepub fn with_skip_missing(self, skip_missing: bool) -> Self
pub fn with_skip_missing(self, skip_missing: bool) -> Self
Controls whether the missing headers will be skipped when not present, or if signing will fail instead.
This is set to true
by default.
sourcepub fn set_signature_created_auto(&mut self) -> &mut Self
pub fn set_signature_created_auto(&mut self) -> &mut Self
Ensures a signature created date will be added automatically with the current time.
This is off by default.
sourcepub fn with_signature_created_auto(self) -> Self
pub fn with_signature_created_auto(self) -> Self
Ensures a signature created date will be added automatically with the current time.
This is off by default.
sourcepub fn signature_created_auto(&self) -> bool
pub fn signature_created_auto(&self) -> bool
Determines if a signature created date will be added automatically with the current time.
This is off by default.
sourcepub fn set_signature_created_at(&mut self, ts: i64) -> &mut Self
pub fn set_signature_created_at(&mut self, ts: i64) -> &mut Self
Ensures a signature created date will be added with the specified unix timestamp.
This is off by default.
sourcepub fn with_signature_created_at(self, ts: i64) -> Self
pub fn with_signature_created_at(self, ts: i64) -> Self
Ensures a signature created date will be added with the specified unix timestamp.
This is off by default.
sourcepub fn signature_created_at(&self) -> Option<i64>
pub fn signature_created_at(&self) -> Option<i64>
Determines if a signature created date will be added with a specific unix timestamp.
This is off by default.
sourcepub fn set_signature_expires_relative(&mut self, offset: i64) -> &mut Self
pub fn set_signature_expires_relative(&mut self, offset: i64) -> &mut Self
Ensures a signature expires date will be added automatically relative to the current time.
This is off by default.
sourcepub fn with_signature_expires_auto(self, offset: i64) -> Self
pub fn with_signature_expires_auto(self, offset: i64) -> Self
Ensures a signature expires date will be added automatically relative to the current time.
This is off by default.
sourcepub fn signature_expires_relative(&self) -> Option<i64>
pub fn signature_expires_relative(&self) -> Option<i64>
Determines if a signature expires date will be added automatically relative to the current time.
This is off by default.
sourcepub fn set_signature_expires_at(&mut self, ts: i64) -> &mut Self
pub fn set_signature_expires_at(&mut self, ts: i64) -> &mut Self
Ensures a signature expires date will be added with the specified unix timestamp.
This is off by default.
sourcepub fn with_signature_expires_at(self, ts: i64) -> Self
pub fn with_signature_expires_at(self, ts: i64) -> Self
Ensures a signature expires date will be added with the specified unix timestamp.
This is off by default.
sourcepub fn signature_expires_at(&self) -> Option<i64>
pub fn signature_expires_at(&self) -> Option<i64>
Determines if a signature expires date will be added with a specific unix timestamp.
This is off by default.
Trait Implementations§
source§impl Clone for SigningConfig
impl Clone for SigningConfig
source§fn clone(&self) -> SigningConfig
fn clone(&self) -> SigningConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more