From 9334819414412795bcee0a2beabf4bfb793cc85f Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Tue, 11 Feb 2025 11:36:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor(liveRoom):=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=E5=8A=A0=E5=AF=86=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 cryptConfig、generateKey、decrypt 和 decryptData 等未使用的加密相关函数 - 优化了代码结构,提高了代码的可读性和维护性 --- app/pages/liveRoom/index.client.vue | 47 ----------------------------- 1 file changed, 47 deletions(-) diff --git a/app/pages/liveRoom/index.client.vue b/app/pages/liveRoom/index.client.vue index 6ad529e..a3ce81f 100644 --- a/app/pages/liveRoom/index.client.vue +++ b/app/pages/liveRoom/index.client.vue @@ -146,53 +146,6 @@ const goBuy = async () => { const tipOpen = () => { message.warning('出价状态未开启') } - -// 加密相关配置 -const cryptConfig = { - password: 'live-skkoql-1239-key', - salt: 'aldk100128ls', - iterations: 10000, - keySize: 32 -} - -// 生成密钥 -const generateKey = (password, salt, iterations, keySize) => { - return CryptoJS.PBKDF2(password, salt, { - keySize: keySize / 4, - iterations: iterations, - hasher: CryptoJS.algo.SHA1 - }).toString(CryptoJS.enc.Hex) -} - -// 解密方法 -const decrypt = (ciphertextBase64, key) => { - const combined = CryptoJS.enc.Base64.parse(ciphertextBase64) - const iv = CryptoJS.lib.WordArray.create(combined.words.slice(0, 4)) - const ciphertext = CryptoJS.lib.WordArray.create(combined.words.slice(4)) - - const decrypted = CryptoJS.AES.decrypt( - {ciphertext: ciphertext}, - CryptoJS.enc.Hex.parse(key), - { - iv: iv, - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - } - ) - - return decrypted.toString(CryptoJS.enc.Utf8) -} - -// 在需要使用时可以调用的解密函数 -const decryptData = (encryptedData) => { - const keyDerived = generateKey( - cryptConfig.password, - cryptConfig.salt, - cryptConfig.iterations, - cryptConfig.keySize - ) - return decrypt(encryptedData, keyDerived) -}