captcha-verifer
![Captcha Verifer package Captcha Verifer](https://developers.google.com/recaptcha/images/newCaptchaAnchor.gif)
Verification your ReCaptcha or HCaptcha is easy
Advantages
- Without any dependencies
- Less than 5 kb
- ES6
- Verify two types of captcha (ReCaptcha and HCaptcha)
- Ease to use
Installation
npm i captcha-verifer
Usage
const Captcha = require('captcha-verifer');
Captcha.verifer({
type: 'recaptcha',
secretKey: 'superSecret',
token: 'TOKEN (Captcha response)',
ip: '47.16.0.0'
})
.then((captcha) => {
if (!captcha.success) return;
})
.catch((e) => console.log(e));
Or
(async () => {
try {
const captcha = await Captcha.verifer({
type: 'hcaptcha',
secretKey: 'superSecret',
token: 'TOKEN (Captcha response)',
ip: '47.16.0.0'
});
if (!captcha.success) return;
} catch (e) {
console.log(e);
}
})();
You can also verify recaptcha 3
Captcha.verifer({
type: 'recaptcha',
secretKey: 'superSecret',
token: 'TOKEN (Captcha response)',
ip: '47.16.0.0'
})
.then((captcha) => {
if (!captcha.success || captcha.score <= 0.3) return;
})
.catch((e) => console.log(e));
License
MIT