Giter VIP home page Giter VIP logo

captcha's Introduction

captcha

A Lightweight Pure JavaScript Captcha for Node.js. No C/C++, No ImageMagick, No canvas. Inspired By rucaptcha.

Installation

$ npm install trek-captcha --save

Examples

'use strict'

const fs = require('fs')
const captcha = require('trek-captcha')

async function run() {
  const { token, buffer } = await captcha()

  // console.log(token, buffer)

  fs.createWriteStream('a.gif').on('finish', () => console.log(token)).end(buffer)
}

run()

API

captcha({ size: 5, style: -1 })

  • size: Defaults to 5.
  • style: Defaults to -1 with random.
// returns
{
  token,
  buffer
}

Badges

Linux Windows codecov


fundon.me  ·  GitHub @fundon  ·  Twitter @_fundon

captcha's People

Contributors

fundon avatar ranyunlong avatar zqingr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

captcha's Issues

Add an option to return Base64 encoded CAPTCHA images

It should be nice to add an option to return the captcha image encoded with base64 so they can be easily embedded on a webpage, for example:
<img alt="Embedded Image" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />

能不能生成别的字符?

注意到源码中有一句 const LETTERS = 'abcdafahijklmnopqrstuvwxyz'
请问是不是只能生成这些字符组成的验证码?如果要生成数字什么的,需要怎样修改?

Alphanumeric captcha

I would like to know if there is any possibility to include numbers 0-9 along with the letters a-z?

I see that the fonts are limited but I can't find any way to add new font.

Generate longer captchas

Every captcha that is generated is 5 characters long.

If I want to generate an 8-length captcha using the code below:
const { token, buffer } = captcha(8)

A 5-length captcha is generated instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.