UNPKG

sveltekit-turnstile

Version:

SvelteKit components for rendering forms and validating form submissions that include cloudflare turnstile tokens for enhanced security

12 lines (11 loc) 627 B
import type { GetClearanceOptions } from './types.js'; /** * Programmatically obtain Cloudflare pre-clearance on the client. * * Renders a Turnstile widget (hidden by default), runs the challenge, and resolves the * Turnstile token on success. When the widget's site key has pre-clearance enabled in the * Cloudflare dashboard and is served on the protected zone, Cloudflare sets the httpOnly * `cf_clearance` cookie automatically as a side effect. Validate the returned token * server-side with `validateToken`. */ export default function getClearance(siteKey: string, options?: GetClearanceOptions): Promise<string>;