@captigo/core
v0.2.0
Published
Core types and CaptchaAdapter contracts for Captigo — provider-agnostic CAPTCHA integration
Maintainers
Readme
@captigo/core
Core types and adapter contracts for Captigo — a provider-agnostic CAPTCHA integration layer.
This package defines the shared types and the CaptchaAdapter / CaptchaWidget
interfaces that every captigo provider implements. You usually install it
alongside a provider package (Turnstile, hCaptcha, reCAPTCHA); it is also pulled
in automatically as a dependency of those adapters.
Use @captigo/core directly when you want to depend only on types, write helper
code against CaptchaAdapter, or share configuration between client and server
without importing a specific provider.
Installation
npm install @captigo/coreMost apps install an adapter as well; @captigo/core is also installed automatically as a dependency of @captigo/turnstile, @captigo/hcaptcha, @captigo/recaptcha, @captigo/react, @captigo/vue, and @captigo/nextjs.
npm install @captigo/core @captigo/turnstileWhat this package exports
- Types:
CaptchaToken,VerifyResult,VerifyOptions,AdapterMeta,CaptchaMode,ProviderId, and related configuration types. - Contracts:
CaptchaAdapter,CaptchaWidget,RenderOptions,WidgetCallbacks,AdapterFactory. - Errors:
CaptchaErrorandCaptchaErrorCode.
See the TypeScript definitions in dist/index.d.ts after build for the full API.
Typical usage
Provider factories return a CaptchaAdapter. Your app passes that adapter to
framework integrations (@captigo/react, @captigo/vue) or calls
adapter.render / adapter.verify yourself:
import type { CaptchaAdapter } from "@captigo/core";
import { turnstile } from "@captigo/turnstile";
const adapter: CaptchaAdapter = turnstile({ siteKey: "..." });Caveats
- This package has no widget UI. Use a provider adapter plus
@captigo/react,@captigo/vue, or your ownadapter.render()integration. - Secrets never belong in client bundles. Use each adapter’s server-side
verify/verifyTokenfrom your backend only.
