We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
貌似是因为没有实现 调用的云函数,可以分享一下demo里用到的云函数吗?
The text was updated successfully, but these errors were encountered:
可以的,你在创建的时候,那里有很多模板,其中一个就是这个代码。
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; }
}
Sorry, something went wrong.
No branches or pull requests
貌似是因为没有实现 调用的云函数,可以分享一下demo里用到的云函数吗?
The text was updated successfully, but these errors were encountered: