verifyAndDecode
Verifies a Resend webhook request's Svix signature with the Resend SDK's Webhooks.verify, then decodes rawBody with decode.
The signature is an HMAC-SHA256 over the svix-id and svix-timestamp headers and rawBody, keyed by the webhook's signing secret. It is compared in constant time, and a timestamp more than five minutes from this host's clock is rejected. Within those five minutes the same signed delivery verifies again, and Resend resends a failed delivery with the same svix-id, so record the ids already handled and skip a repeat.
Header names are matched case-insensitively. Pass the request body exactly as received, decoded from UTF-8, which is what Ktor's call.receiveText() returns for Resend's application/json requests: a body that was parsed and re-serialized no longer matches the signature.
Return
the decoded message, once its signature has been verified
Parameters
the request body, exactly as received
the request headers; only svix-id, svix-timestamp and svix-signature are read
the webhook's signing secret (whsec_...) from the Resend dashboard
Throws
Verifies a Resend webhook request's Svix signature, then decodes rawBody; the overload for Ktor's request Headers, for example verifyAndDecode(call.receiveText(), call.request.headers, secret).
Behaves exactly like the Map overload.
Return
the decoded message, once its signature has been verified
Parameters
the request body, exactly as received
the request headers; only svix-id, svix-timestamp and svix-signature are read
the webhook's signing secret (whsec_...) from the Resend dashboard
Throws
if the signature does not verify; nothing is decoded then
if the signature verifies but rawBody is not an email.* payload