import { type CommentWebhookEvent, type DMWebhookEvent, type MentionWebhookEvent, type TikTokWebhookEvent, type VideoWebhookEvent } from "./webhook-schemas.ts"; export * from "./webhook-schemas.ts"; /** * Verify the HMAC-SHA256 signature on a TikTok webhook payload. * Uses Web Crypto API (works in Bun, Deno, Node 19+, browsers). */ export declare function verifyWebhookSignature(body: string | ArrayBuffer, signature: string, appSecret: string): Promise; export declare class WebhookParseError extends Error { readonly code: "INVALID_SIGNATURE" | "INVALID_PAYLOAD" | "INVALID_JSON"; readonly details?: unknown; constructor(code: WebhookParseError["code"], message: string, details?: unknown); } export interface WebhookParseOptions { body: string; signature: string; appSecret: string; } export type WebhookParseResult = { success: true; data: T; } | { success: false; error: WebhookParseError; }; /** * Verify signature, parse event, and auto-parse the content JSON — all in one call. * Returns a discriminated union. Switch on `data.event` to narrow the content type. * * ```ts * const result = await safeParseTikTokWebhook({ body, signature, appSecret }); * if (!result.success) return; * switch (result.data.event) { * case "post.publish.publicly_available": * console.log(result.data.content.post_id); // typed! * break; * } * ``` */ export declare function safeParseTikTokWebhook(opts: WebhookParseOptions): Promise>; /** Safe-parse, narrowed to VIDEO (publish lifecycle) events only. */ export declare function safeParseVideoWebhook(opts: WebhookParseOptions): Promise>; /** Safe-parse, narrowed to COMMENT events only. */ export declare function safeParseCommentWebhook(opts: WebhookParseOptions): Promise>; /** Safe-parse, narrowed to BRAND_MENTION events only. */ export declare function safeParseMentionWebhook(opts: WebhookParseOptions): Promise>; /** Safe-parse, narrowed to DIRECT_MESSAGE events only. */ export declare function safeParseDMWebhook(opts: WebhookParseOptions): Promise>; /** Verify + parse any TikTok webhook. Throws WebhookParseError on failure. */ export declare function parseTikTokWebhook(opts: WebhookParseOptions): Promise; export declare function parseVideoWebhook(opts: WebhookParseOptions): Promise; export declare function parseCommentWebhook(opts: WebhookParseOptions): Promise; export declare function parseMentionWebhook(opts: WebhookParseOptions): Promise; export declare function parseDMWebhook(opts: WebhookParseOptions): Promise; //# sourceMappingURL=webhooks.d.ts.map