Webhook verification and decoding for mxRaven deliveries.
mxRaven signs every webhook delivery with HMAC-SHA256 over a canonical
request string and sends the signature in X-MxRaven-* headers. A server
that exposes a webhook endpoint verifies the request with a Verifier
and decodes the JSON body:
constsecret = process.env.MXRAVEN_WEBHOOK_SECRET; if (secret === undefined || secret === "") { thrownewError("MXRAVEN_WEBHOOK_SECRET is required"); }
constverifier = newVerifier({ secret });
constevent = awaitverifier.verifyAndDecode(request); switch (event.type) { caseeventType.inboundEmail: // A full inbound message. break; caseeventType.deliveryStatus: // An SMTP delivery status. break; caseeventType.storageStatus: // An object-storage delivery status. break; }
The signing secret is shown only once, when the webhook endpoint is created
or its secret is rotated. The secret is used as literal key bytes; do not
base64-decode it.
Webhook verification and decoding for mxRaven deliveries.
mxRaven signs every webhook delivery with HMAC-SHA256 over a canonical request string and sends the signature in
X-MxRaven-*headers. A server that exposes a webhook endpoint verifies the request with a Verifier and decodes the JSON body:The signing secret is shown only once, when the webhook endpoint is created or its secret is rotated. The secret is used as literal key bytes; do not base64-decode it.