//#region src/types.d.ts interface VerifyWebhookOptions { signedPayload: string; signature: string | null; secret?: string; secrets?: string[]; } type WebhookErrorCode = "missing_secret" | "missing_timestamp" | "invalid_timestamp" | "stale_timestamp" | "invalid_signature" | "body_too_large" | "invalid_json" | "invalid_payload"; interface VerifyWebhookRequestOptions { req: Request; secret?: string; secrets?: string[]; signatureHeader?: string; timestampHeader?: string; toleranceMs?: number; maxBodyBytes?: number; parser?: (body: string) => TPayload; } interface VerifiedWebhook { body: string; payload: TPayload; timestamp: string; } interface EmailWebhookPayload { version: string; type: string; run_id?: string; data?: Record & { api_base_url?: string; callback_url?: string; email?: string; action_type?: string; url?: string; token?: string; new_email?: string; }; } //#endregion //#region src/index.d.ts declare class WebhookError extends Error { readonly code: WebhookErrorCode; constructor(code: WebhookErrorCode, message: string); } declare function verifyWebhookSignature({ signedPayload, signature, secret, secrets }: VerifyWebhookOptions): Promise; declare function verifyWebhookRequest({ req, secret, secrets, signatureHeader, timestampHeader, toleranceMs, maxBodyBytes, parser }: VerifyWebhookRequestOptions): Promise>; //#endregion export { type EmailWebhookPayload, type VerifiedWebhook, type VerifyWebhookOptions, type VerifyWebhookRequestOptions, WebhookError, type WebhookErrorCode, verifyWebhookRequest, verifyWebhookSignature };