import type { WebhookEvent } from "./webhook-events.js"; export * from "./webhook-events.js"; export declare const WEBHOOK_SIGNATURE_HEADER = "modapi-signature"; export declare const WEBHOOK_SECRET_ENV_VAR = "MODAPI_WEBHOOK_SECRET"; /** The signature is missing or does not match the payload. */ export declare class WebhookSignatureError extends Error { name: string; } /** * A webhook delivery. Accepts a Fetch API `Request` (Next.js App Router, Hono, * Bun, Workers) or a Node.js request (Express, Next.js Pages Router) with the * raw body in `body` or still unread on the stream. */ export type WebhookRequest = Request | { body?: BodyInit | Uint8Array | string | null | undefined; headers: Headers | Record; [Symbol.asyncIterator]?: () => AsyncIterator; }; /** * Verify a delivery and return the event. `secret` defaults to the * MODAPI_WEBHOOK_SECRET environment variable. Throws `WebhookSignatureError` * if the signature does not match. * * The payload is not validated against a schema: an event type or field added * to the API later is returned as delivered, never rejected. */ export declare function validateWebhook({ request, secret }: { request: WebhookRequest; secret?: string | undefined; }): Promise; /** Return true if `signature` is the HMAC-SHA256 of the raw `payload`. */ export declare function verifyWebhookSignature(payload: Uint8Array | string, signature: string | null | undefined, secret?: string | undefined): Promise; //# sourceMappingURL=webhook-signature.d.ts.map