Jing-Jiu 4 years ago
parent
commit
f2c12f119d
2 changed files with 1 additions and 36 deletions
  1. 1 1
      pages/supply/mySupply.vue
  2. 0 35
      static/appeal/WXBizDataCrypt.js

+ 1 - 1
pages/supply/mySupply.vue

@@ -29,7 +29,7 @@
             <view class="time">发布时间:{{ supply.time }}</view>
           </view>
           <view class="state">
-            <image src="/static/appeal/waited.png" />
+            <image src="/static/appeal/waited.svg" />
           </view>
         </view>
       </view>

+ 0 - 35
static/appeal/WXBizDataCrypt.js

@@ -1,35 +0,0 @@
-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