2.1.3 • Published 5 years ago

@coolgk/captcha v2.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@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)

ParamTypeDescription
optionsobject
options.secretobjectgoogle captcha secret https://www.google.com/recaptcha/admin#site/337294176

captcha.verify(response, remoteip)

Kind: instance method of Captcha

ParamTypeDescription
responsestringrepsonse from recaptcha
remoteipstringip address
promise
2.1.3

5 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago