@terminaldz/zrexpress-sdk / webhooks / WebhookVerifier
Class: WebhookVerifier
Defined in: webhooks/verifier.ts:17
Constructors
Constructor
ts
new WebhookVerifier(secret): WebhookVerifier;Defined in: webhooks/verifier.ts:25
Parameters
| Parameter | Type | Description |
|---|---|---|
secret | string | the endpoint signing secret (whsec_…) from zr.webhookEndpoints.getSecret(). |
Returns
WebhookVerifier
Throws
ZrExpressWebhookVerificationError when the secret is empty/invalid.
Methods
verify()
ts
verify(rawBody, headers): ParcelWebhookEvent;Defined in: webhooks/verifier.ts:45
Verify a delivery and return the typed event. Pass the raw body (string or Buffer) exactly as received — not a re-serialized object.
Parameters
| Parameter | Type |
|---|---|
rawBody | string | Buffer<ArrayBufferLike> |
headers | Record<string, string> |
Returns
Throws
ZrExpressWebhookVerificationError on a bad signature, a stale timestamp, a tampered body, or an unrecognized payload shape.