JSPM

captcha-verifer

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q34925F
  • License MIT

Verification your ReCaptcha or HCaptcha is easy

Package Exports

  • captcha-verifer
  • captcha-verifer/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (captcha-verifer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

captcha-verifer

Captcha Verifer

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', // Required (recaptcha or hcaptcha)
  secretKey: 'superSecret', // Required
  token: 'TOKEN (Captcha response)', // Required
  ip: '47.16.0.0' // Optional
})
.then((captcha) => {
  if (!captcha.success) return; // Captcha not solved

  /* All good. There is your super code! */
})
.catch((e) => console.log(e));

Or

(async () => {
  try {
    const captcha = await Captcha.verifer({
      type: 'hcaptcha', // Required (recaptcha or hcaptcha)
      secretKey: 'superSecret', // Required
      token: 'TOKEN (Captcha response)', // Required
      ip: '47.16.0.0' // Optional
    });

    if (!captcha.success) return; // Captcha not solved

    /* Your perfect code here */
  } catch (e) {
    console.log(e);
  }
})();

You can also verify recaptcha 3

Captcha.verifer({
  type: 'recaptcha', // Required (recaptcha or hcaptcha)
  secretKey: 'superSecret', // Required
  token: 'TOKEN (Captcha response)', // Required
  ip: '47.16.0.0' //Optional
})
.then((captcha) => {
  if (!captcha.success || captcha.score <= 0.3) return; // Captcha not solved

  /* Pefect. Go ahead */
})
.catch((e) => console.log(e));

License

MIT