Giter Site home page Giter Site logo

getPhone功能不可用 about wechatappdemo HOT 1 OPEN

AnotherW avatar AnotherW commented on May 30, 2024
getPhone功能不可用

from wechatappdemo.

Comments (1)

magic007 avatar magic007 commented on May 30, 2024

可以的,你在创建的时候,那里有很多模板,其中一个就是这个代码。

function onRequest(request, response, modules) {

var appId = 'wx094ede192e7e64b5'
var sessionKey = request.body.sessionKey || 'QQiAgWqKv4hu4Lkn6XE0Jw=='
var encryptedData = request.body.encryptedData || 'FyTPbuir1sSNPvaPxxZiUKatMUuuSi16OlkM7mB+U3pxvdCJ7zUrTz9dnZGnSmi8grDYw/g3GU9bCNUrRGQZ2BORLGKXhCEFBme4n0XJAL/uXwIeivFsZIBkaEfFrAh/DvJGibeCDkfO2zHcSOKTsDwtEBbGdJUz/N3o2WG33m27V72t30UUe+CE26rucjM1zJqHkHEsSr9YOZlFodE0+Q=='
var iv = request.body.iv || '74ExWKy/mxV22YeWaJOVVw=='

var groupid = groupIdParse(modules, sessionKey, encryptedData, iv)
var jsongid = JSON.parse(groupid);
response.end(groupid);
return;

function groupIdParse(modules, sessionKey, encryptedData, iv) {
    var crypto = modules.oCrypto;
    var sessionKey = new Buffer(sessionKey, 'base64'); //new Base64().decode(sessionKey);
    encryptedData = new Buffer(encryptedData, 'base64'); //new Base64().decode(encryptedData);
    iv = new Buffer(iv, 'base64'); //new Base64().decode(iv)
    var result = '';
    try {
        // 解密
        var decipher = crypto.createDecipheriv('aes-128-cbc', sessionKey, iv)
        // 设置自动 padding 为 true,删除填充补位
        decipher.setAutoPadding(true)
        var decoded = decipher.update(encryptedData, 'binary', 'utf8')
        decoded += decipher.final('utf8')
        result = decoded;
        // decoded = JSON.parse(decoded)
    } catch (err) {
        throw new Error('Illegal Buffer123' + err)
    }
   
    return result;
}

}

from wechatappdemo.

Related Issues (5)

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.