ข้ามไปที่เนื้อหาหลัก

Captcha Canvas Challenge

Captcha Canvas Challenge is a standalone image captcha generator. It renders randomized text onto an HTML canvas and returns the resulting image, which communities can present to authors as a spam challenge.

Source code: github.com/bitsocialnet/captcha-canvas-challenge

Requirements

  • Node.js >= 22
  • ESM-only -- this package does not ship CommonJS builds.

Installation

npm install @bitsocial/captcha-canvas-challenge

Configuration Options

OptionTypeDefaultDescription
charactersnumber6Number of random characters rendered in the captcha image.
heightnumber100Height of the generated image in pixels.
widthnumber300Width of the generated image in pixels.
colorsstring#32cf7ePrimary color used for the captcha text.

How It Works

  1. The generator picks a random string of the configured length.
  2. The string is rendered onto a canvas with visual noise to resist OCR.
  3. The resulting image (and the expected answer) are returned so the calling application can present the challenge and later verify the response.

Because the package is a pure image generator, it does not handle networking or session management on its own. It is intended to be integrated into a larger challenge flow -- for example, as one of the challenge types supported by Spam Blocker.