🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

promise-geetest

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-geetest

geetest ad promise wapper

1.0.2
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

base on geetest

useage

npm i geetest promise-geetest --save


const privateKey = 'privateKey'
const publicKey = 'publicKey'
const Geetest = require('promise-geetest')
const geetest = new Geetest(privateKey, publicKey)

router.get('/register', async (ctx) => {
    // 向极验申请一次验证所需的challenge
    const data = await geetest.register().catch(err => null)
    if (data)
        ctx.body = data
    else
        ctx.body = 'error'
})

router.post('/validate', async (ctx) => {
    const {
        geetest_challenge: challenge,
        geetest_validate: validate,
        geetest_seccode: seccode
    } = ctx.request.body
    // 对ajax提交的验证结果值进行验证
    const result = await geetest.validate({ challenge, validate, seccode }).catch(err => null)
    if (result)
        ctx.body = JSON.stringify(result)
    else
        ctx.body = 'error'
})

Keywords

promise

FAQs

Package last updated on 21 Jun 2016

Did you know?

Socket

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