Git Product home page Git Product logo

gt-node-sdk's Introduction

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构造函数,实例化时需要传入一个配置对象

配置对象的字段如下:

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

privateKey和publicKey申请地址:http://account.geetest.com/

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

上述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

gt-node-sdk's People

Contributors

freamerhxl avatar lhtin avatar monkeym4ster avatar suzukua avatar tlqylzn avatar zhangcx93 avatar zhangruinian avatar

Watchers

 avatar

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.