import type { Creatorlayer } from "../Creatorlayer.js"; import type { CreateWebhookParams, Webhook, WebhookEventPayload } from "../types.js"; export declare class Webhooks { private readonly client; constructor(client: Creatorlayer); /** * Register a webhook endpoint to receive verification events. * * @example * const webhook = await cl.webhooks.create({ * url: "https://your-app.example.com/webhooks/creatorlayer", * events: ["verification.completed", "verification.failed"], * }); */ create(params: CreateWebhookParams): Promise; /** * List all registered webhook endpoints. */ list(): Promise; /** * Delete a webhook endpoint. */ del(webhookId: string): Promise; /** * Verify the `X-Creatorlayer-Signature` header on an incoming webhook request. * * Always call this before processing any webhook payload. * Throws `CreatorlayerWebhookSignatureError` if verification fails. * * @example * // Express * app.post("/webhooks/creatorlayer", express.raw({ type: "application/json" }), (req, res) => { * const event = cl.webhooks.verifyAndParse( * req.body, * req.headers["x-creatorlayer-signature"] as string, * process.env.WEBHOOK_SECRET! * ); * if (event.event === "verification.completed") { * // fetch the tape * } * res.sendStatus(200); * }); */ verifyAndParse(rawBody: Buffer | string, signature: string, secret: string): WebhookEventPayload; /** * Returns true if the signature is valid, false otherwise. * Use `verifyAndParse` if you want to parse the payload at the same time. */ verifySignature(rawBody: Buffer | string, signature: string, secret: string): boolean; } //# sourceMappingURL=Webhooks.d.ts.map