/** * hCaptcha Handler * * Supports hCaptcha (privacy-focused CAPTCHA alternative) * * Test mode bypass uses hCaptcha's official test keys: * - Site key: 10000000-ffff-ffff-ffff-000000000001 * - Secret key: 0x0000000000000000000000000000000000000000 * * @see https://docs.hcaptcha.com/#integration-testing-test-keys */ export interface HcaptchaConfig { /** Site key for hCaptcha */ siteKey?: string; /** Use test mode (always returns valid token) */ testMode?: boolean; /** CSS selector for the hCaptcha container */ selector?: string; /** Timeout for solving (ms) */ timeout?: number; /** hCaptcha is invisible/challenge-only */ isInvisible?: boolean; } export interface HcaptchaTokenResponse { success: boolean; token: string; challengeTs?: string; hostname?: string; errorCodes?: string[]; } export declare const HCAPTCHA_TEST_SITE_KEY = "10000000-ffff-ffff-ffff-000000000001"; export declare const HCAPTCHA_TEST_SECRET = "0x0000000000000000000000000000000000000000"; export declare class HcaptchaHandler { private testMode; private timeout; constructor(options?: { testMode?: boolean; timeout?: number; }); /** * Detect if hCaptcha is present on the page */ detectHcaptcha(page: any): Promise<{ present: boolean; siteKey?: string; isInvisible?: boolean; }>; /** * Solve hCaptcha * * In test mode, injects a test token * In production, waits for user interaction */ solve(page: any, config?: HcaptchaConfig): Promise; /** * Solve hCaptcha in test mode */ private solveTestMode; /** * Solve hCaptcha in production mode (requires human interaction) */ private solveProduction; /** * Execute hCaptcha (for invisible hCaptcha) */ execute(page: any, config?: HcaptchaConfig): Promise; /** * Verify an hCaptcha token (server-side simulation) * * In real usage, this would call hCaptcha's siteverify API: * POST https://hcaptcha.com/siteverify */ verifyToken(token: string, secret?: string): Promise; /** * Wait for hCaptcha to be ready */ waitForReady(page: any, timeout?: number): Promise; /** * Inject test site key into page */ injectTestSiteKey(page: any, elementSelector: string): Promise; /** * Generate a test token for mocking */ private generateTestToken; private sleep; /** * Reset all hCaptcha widgets on the page */ reset(page: any): Promise; /** * Get the current response token from hCaptcha */ getResponse(page: any, widgetId?: string): Promise; } /** * Factory function to create an hCaptcha handler */ export declare function createHcaptchaHandler(options?: { testMode?: boolean; timeout?: number; }): HcaptchaHandler; export default HcaptchaHandler;