import { RiskIntelligenceRetrieveResult, VerifyResult } from "./result.js"; /** * Configuration options when creating a new `FriendlyCaptchaClient`. * @public */ export interface FriendlyCaptchaOptions { sitekey?: string; /** * Friendly Captcha API Key. */ apiKey: string; /** * The API endpoint domain to use. Can be "eu", "global", or a custom domain (e.g., "https://api.example.com"). * Do not include a path - it will be automatically appended. * * Defaults to `"global"`. */ apiEndpoint?: string; /** * @deprecated Use `apiEndpoint` instead. This option will be removed in a future version. * * The endpoint to use for the API. Can be "eu", "global", or a custom URL. * If a full URL with a path is provided, the path will be stripped. * * Defaults to `"global"`. */ siteverifyEndpoint?: string; /** * Whether to use strict mode, which rejects all captcha responses which were not strictly verified. * * This is not recommended. Defaults to `false`. */ strict?: boolean; /** * The fetch implementation to use. Defaults to `globalThis.fetch`. */ fetch?: typeof globalThis.fetch; } /** * A client for the Friendly Captcha API. * @public */ export declare class FriendlyCaptchaClient { private sitekey?; private apiKey; private siteverifyEndpoint; private riskIntelligenceRetrieveEndpoint; private strict; private fetch; constructor(opts: FriendlyCaptchaOptions); private getHeaders; /** * Generic method to make API requests with common error handling. * @param endpoint - The API endpoint URL to call * @param requestBody - The request body object * @param result - The result object to populate * @param timeout - The timeout in milliseconds */ private makeRequest; /** * Get the siteverify endpoint URL being used by this client. * @internal - For testing purposes only */ getSiteverifyEndpoint(): string; /** * Verify a captcha response. * * @param response - The response token from the captcha. * @param opts - Optional options object: * * `timeout`: The timeout in milliseconds. Defaults to 20 seconds. * * `sitekey`: The sitekey to use for this request. Defaults to the sitekey passed to the constructor (if any). * @returns A promise that always resolves to a `VerifyResult` object, which contains the fields `shouldAccept()` and `wasAbleToVerify()`. This promise never rejects. */ verifyCaptchaResponse(response: string, opts?: { timeout?: number; sitekey?: string; }): Promise; /** * Retrieve risk intelligence data for a given risk intelligence token. * @param token - The risk intelligence token. * @param opts - Optional options object: * * `timeout`: The timeout in milliseconds. Defaults to 20 seconds. * * `sitekey`: The sitekey to use for this request. Defaults to the sitekey passed to the constructor (if any). * @returns A promise that resolves to a `RetrieveResult` object. */ retrieveRiskIntelligence(token: string, opts?: { timeout?: number; sitekey?: string; }): Promise; }