#[non_exhaustive]pub enum VerifyError {
MissingHeader {
header: &'static str,
},
MalformedHeader {
header: &'static str,
reason: &'static str,
},
BadEncoding {
reason: &'static str,
},
SignatureMismatch,
TimestampOutOfTolerance {
skew: Duration,
max_age: Duration,
},
UnsupportedProvider,
InvalidSecret {
reason: &'static str,
},
MissingContext {
reason: &'static str,
},
}Expand description
Everything that can go wrong while verifying a webhook signature.
MissingHeader / MalformedHeader / BadEncoding indicate malformed
requests; SignatureMismatch indicates an active-attack signal (or an
out-of-band misconfiguration). Callers that log differently per class can
match on the variants — but both classes are “reject the request”
outcomes. Never treat a malformed header as “skip verification”.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingHeader
A required signature-related header was absent.
MalformedHeader
A required header was present but could not be parsed into the shape the provider’s scheme requires (wrong prefix, empty value, …).
Fields
BadEncoding
A value that must decode in the provider’s encoding (hex, base64) failed to decode, or decoded to the wrong length.
SignatureMismatch
The signature did not match. Returned identically regardless of how close the provided signature was to the expected one.
TimestampOutOfTolerance
The signed timestamp is further from “now” than [VerifyOptions:: max_age] allows; skew is how far outside the window it fell.
Fields
UnsupportedProvider
The selected crate::Provider exists but has no verification
implementation yet (fail-closed stub for providers not shipped).
InvalidSecret
The provided secret is not usable for this provider’s scheme (e.g. wrong format for a hex- or base64-encoded key).
MissingContext
Verification for this provider requires caller-supplied request
context (such as Square’s notification URL, via
crate::VerifyOptions::request_url) that was not provided. This is
an operator misconfiguration, not an attack signal — but the request
is still rejected: fail closed.
Trait Implementations§
Source§impl Clone for VerifyError
impl Clone for VerifyError
impl Copy for VerifyError
Source§impl Debug for VerifyError
impl Debug for VerifyError
Source§impl Display for VerifyError
impl Display for VerifyError
impl Eq for VerifyError
Source§impl Error for VerifyError
Available on crate feature std only.
impl Error for VerifyError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()