Socket
Socket
Sign inDemoInstall

geetest

Package Overview
Dependencies
47
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    geetest

Node SDK for Geetest captcha


Version published
Weekly downloads
69
decreased by-48.12%
Maintainers
2
Install size
3.87 MB
Created
Weekly downloads
 

Changelog

Source

3.0.0

  1. 鉴于遇到很多用户对 publicKeyprivateKey 容易搞混淆,先将其改名为 geetest_idgeetest_key 。因此,和以前的版本无法兼容,所以修改主版本号。

Readme

Source

注意:3.x.x修改了所传入的字段名称,将publicKey和privateKey修改为geetsest_id和geetest_key,升级会造成不兼容问题,请各位注意在升级前修改相应的字段名称,新用户无须关注此修改

Install 安装

npm install geetest

运行DEMO

cd Project
git clone https://github.com/GeeTeam/gt-node-sdk.git
cd gt-node-sdk
npm install
npm run server
// 最后请打开浏览器访问localhost:8080
// 了解sdk的使用方式请查阅demo目录下的app.js文件

使用说明

sdk提供Geetest构造函数,实例化时需要传入一个配置对象

配置对象的字段如下:

  • geetest_id:验证私钥,必须
  • geetest_key:验证公钥,必须
  • protocol:与极验服务器交互时使用的协议,默认为http://,可选
  • apiServer:针对私有化用户提供对默认的api.geetest.com进行修改,普通用户无需关注此选项,可选

geetest_id和geetest_keyy申请地址:http://account.geetest.com/

var Geetest = require('geetest');
var captcha = new Geetest({
    geetest_id: 'xxx', // 将xxx替换为您申请的id
    geetest_key: 'xxx', // 将xxx替换为您申请的key
});

上述Geetest的实例captcha提供两个方法:

register(callback)

captcha.register(function (data) {
    // data为一个对象,里面包含challenge和success字段
    // 正常模式下challenge为32为,success为1
    // failback模式下challenge为34为,success为0
});

validate(result, callback)

captcha.validate({
    challenge: 'xxx',
    validate: 'xxx',
    seccode: 'xxx'
}, function (err, success) {
    // err存在表示出现网络错误
    // success表示二次查询是否成功
}

使用前,强烈建议您阅读我们的 入门文档

更新历史:CHANGELOG

Keywords

FAQs

Last updated on 18 Aug 2016

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc