UNPKG

click-captcha

Version:

Chinese Character Sequence Click Verification System

34 lines (33 loc) 1.1 kB
import type { CaptchaOptions, CaptchaResult, Coordinate, VerificationPoint } from "../types"; export declare class ClickCaptcha { private options; constructor(options?: CaptchaOptions); private validateOptions; /** * 生成随机位置 */ private getRandomPosition; /** * 生成随机字符 */ private getRandomChar; /** * @author Qing * @description 生成点击验证码 * @return {Promise<CaptchaResult>} 验证码结果 * @example * const captcha = new ClickCaptcha(); * const { image, hint, data } = await captcha.generate(); * @date 2025-02-14 10:21:01 */ generate(): Promise<CaptchaResult>; /** * @author Qing * @description 验证点击位置 * @param {Coordinate[]} userPositions 用户点击位置 * @param {VerificationPoint[]} verificationPoints 数据中的正确的验证码字符位置 * @return {boolean} 是否验证通过 * @date 2025-02-14 10:20:16 */ verify(userPositions: Coordinate[], verificationPoints: VerificationPoint[]): boolean; }