@restaq/clerk
Clerk webhook plugin with Svix signature verification.
Install
pnpm add @restaq/clerkPeer dependency: @restaq/core
Exports
| Export | Kind | Description |
|---|---|---|
clerk | Function | Creates a Clerk plugin for webhook ingestion. |
ClerkEventMap | Type | Typed event map for common Clerk webhook events. |
ClerkPluginOptions | Type | Configuration for the Clerk plugin. |
Types
ClerkEventMap
type ClerkEventMap = {
[K in ClerkEventType as `clerk.${K}`]: ClerkWebhookPayload;
};Covers Clerk's most common events — user.created/updated/deleted, session.*, organization.*, organizationMembership.*, organizationInvitation.*. Clerk doesn't publish a typed events SDK the way Stripe or GitHub do, so ClerkWebhookPayload is Record<string, unknown> & { id?: string } rather than a per-event shape — check the Event Catalog in your Clerk Dashboard for a given event's exact fields.
ClerkPluginOptions
type ClerkPluginOptions = {
webhookSecret?: string;
toleranceSeconds?: number;
};Configuration for the Clerk plugin. webhookSecret defaults to process.env.CLERK_WEBHOOK_SECRET if not passed. toleranceSeconds (default: 300) sets the maximum age of a signed timestamp before it's rejected.
Functions
clerk
function clerk(options?: ClerkPluginOptions): RelayPlugin<ClerkEventMap>;Creates a Clerk plugin. Verifies Svix webhook signatures from Svix-Id, Svix-Timestamp, and Svix-Signature, normalizes incoming events as clerk.<event type>, and uses CLERK_WEBHOOK_SECRET by default.