@coolgk/captcha
TypeScript icon, indicating that this package has built-in type declarations

2.1.3 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @coolgk/captcha

Weekly Downloads

4

Version

2.1.3

License

MIT

Unpacked Size

6.33 kB

Total Files

5

Last publish

Collaborators

  • coolgk