li.shaoyi 3 年之前
父節點
當前提交
53f3ae902c
共有 1 個文件被更改,包括 1 次插入8 次删除
  1. 1 8
      src/utils/websocket/crypto/index.ts

+ 1 - 8
src/utils/websocket/crypto/index.ts

@@ -167,15 +167,8 @@ export const decryptAES = (value: string): string | undefined => {
     });
 
     const decrytped = CryptoJS.AES.decrypt(cipherParams, uint8ArrayToWordArray(key), aesOption);
-
-    let h = wordArrayToUint8Array(decrytped);
-    const index = h.findIndex(item => item == 4);
-    if (index !== -1) {
-        h = h.subarray(0, index - 1);
-    }
-
+    const h = wordArrayToUint8Array(decrytped).subarray(0, decrytped.words.length * 4 - 1);
     const result = new TextDecoder().decode(h);
-    debugger
     return result;
 };