update
This commit is contained in:
1
.env
1
.env
@@ -1,2 +1,3 @@
|
||||
VITE_API_URL=http://127.0.0.1:4523
|
||||
VITE_TINYMCE_KEY=agmu6i1c6k7bcp36oenzyz7yi1yplptq7goyx88y1g6ofnqu
|
||||
VITE_AES_KEY=4e2c3d4e5f6a7b8c9d0e1f2g3h4i5j6k7l8m9n0o1p2q3r4s5t6u7v8w9x0y1z2
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"dependencies": {
|
||||
"@tinymce/tinymce-vue": "^6.1.0",
|
||||
"axios": "^1.8.2",
|
||||
"crypto-js": "^4.2.0",
|
||||
"pinia": "^3.0.1",
|
||||
"pinia-plugin-persistedstate": "^4.2.0",
|
||||
"tinymce": "^7.7.2",
|
||||
@@ -24,6 +25,7 @@
|
||||
"devDependencies": {
|
||||
"@arco-design/web-vue": "^2.56.3",
|
||||
"@arco-plugins/vite-vue": "^1.4.5",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"sass": "^1.85.1",
|
||||
"tailwindcss": "^3.4.17",
|
||||
|
||||
16
pnpm-lock.yaml
generated
16
pnpm-lock.yaml
generated
@@ -14,6 +14,9 @@ importers:
|
||||
axios:
|
||||
specifier: ^1.8.2
|
||||
version: 1.8.2
|
||||
crypto-js:
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0
|
||||
pinia:
|
||||
specifier: ^3.0.1
|
||||
version: 3.0.1(vue@3.5.13)
|
||||
@@ -45,6 +48,9 @@ importers:
|
||||
'@arco-plugins/vite-vue':
|
||||
specifier: ^1.4.5
|
||||
version: 1.4.5
|
||||
'@types/crypto-js':
|
||||
specifier: ^4.2.2
|
||||
version: 4.2.2
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: ^5.2.1
|
||||
version: 5.2.1(vite@6.2.0(jiti@2.4.2)(sass@1.85.1)(yaml@2.7.0))(vue@3.5.13)
|
||||
@@ -645,6 +651,9 @@ packages:
|
||||
tinymce:
|
||||
optional: true
|
||||
|
||||
'@types/crypto-js@4.2.2':
|
||||
resolution: {integrity: sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==}
|
||||
|
||||
'@types/estree@1.0.6':
|
||||
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
|
||||
|
||||
@@ -871,6 +880,9 @@ packages:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
crypto-js@4.2.0:
|
||||
resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
|
||||
|
||||
cssesc@3.0.0:
|
||||
resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -2341,6 +2353,8 @@ snapshots:
|
||||
optionalDependencies:
|
||||
tinymce: 7.7.2
|
||||
|
||||
'@types/crypto-js@4.2.2': {}
|
||||
|
||||
'@types/estree@1.0.6': {}
|
||||
|
||||
'@types/node@16.18.126': {}
|
||||
@@ -2617,6 +2631,8 @@ snapshots:
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
crypto-js@4.2.0: {}
|
||||
|
||||
cssesc@3.0.0: {}
|
||||
|
||||
csstype@3.1.3: {}
|
||||
|
||||
30
src/utils/AESCrypto.js
Normal file
30
src/utils/AESCrypto.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import AES from 'crypto-js/aes.js';
|
||||
import utf8 from 'crypto-js/enc-utf8.js';
|
||||
|
||||
class AESCrypto {
|
||||
/**
|
||||
* 密钥
|
||||
* @type {string}
|
||||
*/
|
||||
static #AES_KEY = process.env.VITE_AES_KEY;
|
||||
|
||||
/**
|
||||
* AES加密
|
||||
* @param context {string} 加密内容
|
||||
*/
|
||||
static encrypt = (context) => {
|
||||
return AES.encrypt(context, this.#AES_KEY).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
* @param context {string}
|
||||
* @return {string}
|
||||
*/
|
||||
static decrypt = (context) => {
|
||||
const bytes = AES.decrypt(context, this.#AES_KEY);
|
||||
return bytes.toString(utf8);
|
||||
}
|
||||
}
|
||||
|
||||
export default AESCrypto;
|
||||
Reference in New Issue
Block a user