Skip to content

By using "Fast Captcha," you can enhance the security and user experience of your web application by adding CAPTCHA protection to your forms. This npm package simplifies the process of CAPTCHA generation and validation, helping you guard against automated spam and fraudulent submissions.

Notifications You must be signed in to change notification settings

avinashtare/fast-captcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ FAST CAPTCHA ⚡

Fast captcha logo

By using "Fast Captcha," you can enhance the security and user experience of your web application by adding CAPTCHA protection to your forms. This npm package simplifies the process of CAPTCHA generation and validation, helping you guard against automated spam and fraudulent submissions.

Installation

To install the Fast Captcha package, you can use npm:

npm install fast-captcha

Usage

Generate a new CAPTCHA:

const { getNewCaptcha } = require('fast-captcha');

const newCaptcha = getNewCaptcha();
console.log('CAPTCHA ID:', newCaptcha.id); // unique image id
console.log('CAPTCHA Data URL:', newCaptcha.imageData); // base64 image

Verify a new CAPTCHA:

const { verifyCaptcha} = require('fast-captcha');

const userAnswer = '1aOMC'; 
const captchaId = 34;// enter you captcha id 

const isVerified = verifyCaptcha(captchaId, userAnswer);
console.log('CAPTCHA Verification Result:', isVerified); // true or false

if(isVerified){
    console.log("okkkkkk");
}
else{
    console.log("Wrong Captcha");
}

Parameters:

  • captchaId: repalce with your uniqe captcha id.
  • userAnswer: Enter answer of captcha.

Returns:

It Return True Or False Boolean Value.

Express Example

Show Captcha Image:

const express = require('express')
const app = express()
const { getNewCaptcha } = require('fast-captcha');

app.get('/', function (req, res) {
    let Captcha = getNewCaptcha();
    let uniqId = Captcha.id; // store it in you database to cross check captcha 
    res.send(`<img src="${Captcha.imageData}">`);
})

app.listen(3000, () => console.log("app running on port http://localhost:3000"))
$ npm install

Start the server:

$ npm start

View the website at: http://localhost:3000

License

License This project is released under the MIT License.
Free Package, Hell Yeah!

Contact

[email protected]

Author

卐🕉 Avinash Tare 🕉 卐

About

By using "Fast Captcha," you can enhance the security and user experience of your web application by adding CAPTCHA protection to your forms. This npm package simplifies the process of CAPTCHA generation and validation, helping you guard against automated spam and fraudulent submissions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published