Files
WRNexusJS/packages/captcha/src/providers/hcaptcha.ts
T
2026-07-25 13:38:18 +05:30

25 lines
737 B
TypeScript

import { SiteverifyCaptchaProvider, type SiteverifyProviderOptions } from "./siteverify.ts";
export class HcaptchaProvider extends SiteverifyCaptchaProvider {
constructor(options: SiteverifyProviderOptions) {
super(
{
name: "hcaptcha",
endpoint: "https://api.hcaptcha.com/siteverify",
client: {
responseField: "h-captcha-response",
scriptUrl: "https://js.hcaptcha.com/1/api.js?render=explicit",
widgetClass: "h-captcha",
},
sendSiteKey: true,
scoreDirection: "higher-is-risk",
},
options,
);
}
}
export function hcaptchaProvider(options: SiteverifyProviderOptions): HcaptchaProvider {
return new HcaptchaProvider(options);
}