(data)
| 72 | } |
| 73 | |
| 74 | function encryptPayload(data) { |
| 75 | const t = Math.floor(Date.now() / 1000); |
| 76 | const date = formatDateTime(t); |
| 77 | const key = Buffer.from(md5(ENCRYPT_SALT + date + t).substring(8, 24)); |
| 78 | const iv = Buffer.from(md5(date + t + ENCRYPT_SALT).substring(8, 24)); |
| 79 | const cipher = crypto.createCipheriv("aes-128-cbc", key, iv); |
| 80 | cipher.setAutoPadding(false); |
| 81 | const input = zeroPad(Buffer.from(JSON.stringify(data), "utf8")); |
| 82 | const encode = Buffer.concat([cipher.update(input), cipher.final()]).toString("base64"); |
| 83 | return { encode, t, bd: BRAND_ID }; |
| 84 | } |
| 85 | |
| 86 | function isTokenError(message) { |
| 87 | return /40313|40317|unlogin|token|登录|授权|invalid/i.test(String(message || "")); |
no test coverage detected