Socket
Book a DemoInstallSign in
Socket

node-svgcaptcha

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-svgcaptcha

SVG captcha generator

1.0.1
latest
npmnpm
Version published
Maintainers
1
Created
Source

node-svgcaptcha

A npm module to generate a captcha with svg image

How to use:

Install npm package:

npm install node-svgcaptcha

In your code:

app.get('/captcha', function(req, res){

	var captcha = require('node-svgcaptcha');
	var options = {};//Set your configuration in this object
	var genCaptcha = captcha(options);
	
	if(req.session){//save value in session
		req.session.captcha = genCaptcha.captchaValue;
	}
	
	//return svg to render in the browser
	res.set('Content-Type', 'image/svg+xml');
	res.send(genCaptcha.svg);	
});

Options:

  Options that we can pass to the module with the default values:
  
  values: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' // String with chars to generate random captcha
	length: 8 // lenght of chars in generated captcha
	width: 200 // width of the generated image
	height: 50 // height of the generated image
	color: true // true means that letters are painted in colors and false in gray scale
	lines: 2 // number of lines in the captcha
	noise: 1 // level of noise (points) in the captcha
	

Keywords

captcha

FAQs

Package last updated on 01 Jan 2015

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.