Skip to main content

verify_webhook_signature

Function verify_webhook_signature 

Source
pub fn verify_webhook_signature(
    provider: WebhookProvider,
    body: &[u8],
    secret: &[u8],
    header_value: &str,
) -> bool
Available on crate feature webhook only.
Expand description

Verifies header_value against body and secret using provider’s signature convention. Returns false on any failure: wrong secret, tampered body, malformed header, or (Stripe only) a timestamp outside the default tolerance window.

body must be the exact raw request bytes — re-serializing a parsed JSON body before verifying will not reproduce the byte sequence the provider signed and will always fail verification.