Verify the authenticity and integrity of incoming Codat webhook payloads.
Codat signs deliveries using the Svix HMAC-SHA256 standard. Verification covers authenticity, integrity, and replay protection.
Usage
case Codat.Webhooks.Verifier.verify(secret, raw_body, headers) do
:ok -> # authentic and recent — process the event
{:error, :invalid_signature} -> # reject — not from Codat
{:error, :expired} -> # reject — possible replay attack
{:error, :missing_headers} -> # reject — required headers absent
end
Summary
Functions
Verifies a Codat webhook payload against its signature headers.
Like verify/4 but raises Codat.Webhooks.VerificationError on failure.
Types
Functions
Verifies a Codat webhook payload against its signature headers.
Options
:tolerance— max age in seconds (default: 300):now— override the current timestamp for testing (Unix seconds)
Like verify/4 but raises Codat.Webhooks.VerificationError on failure.