@coolgk/captcha
recapcha wrapper
Last updated 10 months ago by coolgk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @coolgk/captcha 
SYNC missed versions from official npm registry.

@coolgk/captcha

a javascript / typescript module

npm install @coolgk/captcha

recapcha wrapper

Report bugs here: https://github.com/coolgk/node-utils/issues

Examples

const { verify } = require('@coolgk/captcha');
const secret = '-------';

verify(secret, captchaResponse).then((response) => {
    console.log(response); // { success: true, challenge_ts: '2017-12-03T08:19:48Z', hostname: 'www.google.com' }
                           // { success: false, 'error-codes': [ 'invalid-input-response' ] }
});

// OR

import { Captcha } from '@coolgk/captcha';
// OR
// const { Captcha } = require('@coolgk/captcha');

const captcha = new Captcha({ secret });

const captchaResponse = '---------';

captcha.verify(captchaResponse).then((response) => {
    console.log(response); // { success: true, challenge_ts: '2017-12-03T08:19:48Z', hostname: 'www.google.com' }
                           // { success: false, 'error-codes': [ 'invalid-input-response' ] }
});

Captcha

Kind: global class

new Captcha(options)

Param Type Description
options object
options.secret object google captcha secret https://www.google.com/recaptcha/admin#site/337294176

captcha.verify(response, [remoteip])

Kind: instance method of Captcha

Param Type Description
response string repsonse from recaptcha
[remoteip] string ip address
promise

Current Tags

  • 2.1.3                                ...           latest (10 months ago)

21 Versions

  • 2.1.3                                ...           10 months ago
  • 2.1.2                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.5                                ...           2 years ago
  • 2.0.4                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 21
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |