Socket
Socket
Sign inDemoInstall

gimpy-captcha

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gimpy-captcha

simple but hard to crack captcha library


Version published
Weekly downloads
95
increased by72.73%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Usage

Generating a captcha

const Captcha = require("gimpy-captcha");

const captchaConfig = {
  mode: "math", // or code
  cryptoKey: "ezrvvv",
  signatureKey: "man0lett3",
  noise: 20,
};

function generateCaptcha() {
  const captchaConfig = Captcha.CaptchaConfigManager.default(captchaConfig);
  const captcha = Captcha.create(captchaConfig);

  return {
    // The captcha SVG that you can display inside e.g. a form
    captchaSvg: captcha.captchaSvg,

    // This is the un-encrypted expression of the captcha.
    captchaExpression: captcha.expr,

    // This is the encrypted expression of the captcha.
    // Pass it along with your server side verification requests.
    encryptedCaptchaExpression: captcha.encryptedExpr,
  };
}

Verifying a captcha

const Captcha = require("gimpy-captcha");

function verify(encryptedCaptchaExpression, captchaSolution) {
  const captchaResult = Captcha.verify(
    captchaExpression,
    captchaSolution,
    "ezrvvv"
  );
  return captchaResult; // either true on success or false if the solution was wrong
}

Testing

npm run test

or

npm run test:tdd

FAQs

Last updated on 24 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc