Socket
Book a DemoInstallSign in
Socket

behavioral-captcha

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

behavioral-captcha

A behavioral captcha generator for NodeJS.

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

node-behavioral-captcha npm GitHub

This is a simple behavioral captcha for node.js. (Based on @napi-rs/canvas)

Screenshots

Selection Captcha

selection

Calculation Captcha

calculation

Installation

npm install behavioral-captcha

Usage

import { createSelectionCaptchaGenerator } from 'behavioral-captcha'

/*
const config = {
  size: { width: 300, height: 240 },
  thumbSize: { width: 150, height: 40 },
  textColors: ['#000', '#333', '#666', '#999', '#ccc', '#fff'],
  thumbTextColors: ['#000', '#333', '#666', '#999', '#ccc', '#fff'],
  fontSize: [30, 38],
  thumbFontSize: [24, 30],
  length: [5, 7],
  checkLength: [2, 4],
  thumbBackgroundColor: '#fff',
  chars: defaultcChars,
  fonts: ['Arial', { path: 'SomeFont.ttf', name: 'SomeFont' }],
  backgroundImages: ['image1.jpg', 'image2.jpg'],
  angles: [[0, 15]],
  quality: 80
}
*/
const generator = await createSelectionCaptchaGenerator()

const captcha = await generator.generate()
/*
{
  image: Buffer,
  thumb: Buffer,
  dots: Array<{ x: number, y: number }>,
}
*/

console.log(captcha)

console.log(await generator.verify([[13, 67], [78, 143]], captcha.dots)) // true

Author

Shirasawa

License

MIT

Keywords

captcha

FAQs

Package last updated on 06 Sep 2024

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.