Skip to content

verify

function verify(input): Promise<WebhookEnvelope>;

Defined in: src/signing.ts:189

Verify an incoming Standard Webhooks request (from any compliant sender, not just this package). Checks the timestamp tolerance, then compares every v1, signature in the header against every candidate secret in constant time. Returns the parsed envelope on success; throws WebhookVerificationError otherwise.

Parameter Type
input VerifyInput

Promise<WebhookEnvelope>

import { verify } from "@xtandard/webhooks/signing";
const envelope = await verify({
payload: rawBody,
headers: { "webhook-id": id, "webhook-timestamp": ts, "webhook-signature": sig },
secret: "whsec_…",
});