f4c-turnstile-gate v0.1.0
adapter
capsule://quake0day/[email protected]
Provides a React component to integrate Cloudflare Turnstile for bot verification, wrapping the application content. It handles the client-side rendering of the Turnstile widget and stores the token in session storage.
Owns
- Client-side Turnstile widget rendering
- Storing Turnstile token in `sessionStorage`
- Wrapping application content with a verification gate
Does not own
- Server-side Turnstile token verification
- Core application logic or UI
AI orientation
This capsule handles client-side Turnstile integration. Agents should focus on ensuring the widget loads correctly, token storage is secure, and the component integrates seamlessly with the application flow. The `TURNSTILE_SITEKEY` is crucial.
Avoid
- Adding server-side verification logic.
- Introducing direct dependencies on application-specific components.
Provides
library:TurnstileGate— React component that displays a Cloudflare Turnstile challenge.env:sessionStorage.ts_token— Stores the successfully verified Turnstile token in browser session storage.
Requires
http_api:Cloudflare Turnstile JS API— Loads the Turnstile JavaScript API from Cloudflare.
Invariants (must always hold)
- A valid Turnstile token must be stored in `sessionStorage` upon successful verification.
- The component must re-challenge if `sessionStorage.ts_token` is not present or on route change.
Source files (1)
Click any file to view its content; the path on the right shows where the file lands when this capsule is installed.
src/app/src/components/TurnstileGate.tsx→components/TurnstileGate.tsx
Plus capsule.yaml and
install.json.