🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

captcha-generator-react

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

captcha-generator-react

A lightweight utility to generate image-based captchas using the HTML5 Canvas API. Returns a base64 image and the corresponding captcha text for easy verification.

1.5.0
70

Supply Chain Security

100

Vulnerability

87

Quality

77

Maintenance

100

License

Version published
Weekly downloads
27
285.71%
Maintainers
1
Weekly downloads
 
Created

Generate captcha

A lightweight utility to generate image-based captchas using the HTML5 Canvas API. Returns a base64 image and the corresponding captcha text for easy verification.

✨ Features

  • Generates random captchas using alphanumeric characters
  • Returns both captcha text and base64 image
  • Customizable width, height, and character length
  • Adds random interference lines for better security

📦 Installation

Using npm

npm install captcha-generator-react

Using pnpm

pnpm add captcha-generator-react

Usage

import generateCaptcha from "generate-captcha";

const { captchaText, captchaImage } = generateCaptcha();

console.log(captchaText); // Example: "aZ4pQ2"
console.log(captchaImage); // Base64-encoded PNG image

// You can also customize the captcha length, width, and height:
const { captchaText, captchaImage } = generateCaptcha(5, 150, 50);

FAQs

Package last updated on 02 May 2025

Did you know?

Socket

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