- 获取手机号之后解密问题?
[图片] 以下是解密代码: var crypto = require('crypto') function WXBizDataCrypt(appId, sessionKey) { this.appId = appId this.sessionKey = sessionKey } WXBizDataCrypt.prototype.decryptData = function (encryptedData, iv) { // base64 decode var sessionKey = new Buffer(this.sessionKey, 'base64') encryptedData = new Buffer(encryptedData, 'base64') iv = new Buffer(iv, 'base64') 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') decoded = JSON.parse(decoded) } catch (err) { throw new Error('Illegal Buffer') } if (decoded.watermark.appid !== this.appId) { throw new Error('Illegal Buffer') } return decoded } module.exports = WXBizDataCrypt 以下是调用代码: let pc = new WXBizDataCrypt('***************', this.sessionKey); let data = pc.decryptData(e.detail.encryptedData, e.detail.iv); 求指教
2021-05-17 - 小程序开发工具清除缓存失败?
message:清除登录状态失败 41001 appid: openid: ideVersion: 1.05.2104251 osType: win32-x64 time: 2021-05-06 09:09:51 上面是提示信息,前两天还能运行
2021-05-06