mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-09-13 07:43:43 +08:00
update 升级 依赖版本并替换废弃依赖 crypto-js
- 替换已废弃的 crypto-js 为 @noble/ciphers@2.4.0(零依赖、经过安全审计),
重写 src/utils/crypto.ts,密文格式保持 AES-256-ECB/PKCS7Padding + Base64,
与后端 Hutool AES 完全兼容,后端零改动(已通过 openssl 比对验证)
- 升级 @wangeditor-next/editor 5.7.16 -> 6.4.1、
@wangeditor-next/editor-for-vue 5.1.14 -> 6.4.1(版本严格对齐,
v6 唯一不兼容点为视频对齐 HTML 结构,导入时自动迁移)
- 升级 vue 3.5.40 -> 3.5.42、element-plus 2.14.3 -> 2.14.5、
vxe-table 4.20.8 -> 4.21.9、vxe-pc-ui 4.16.22 -> 4.18.9、
axios 1.18.1 -> 1.20.0、pinia 4.0.2 -> 4.0.3、vue-router 5.2.0 -> 5.3.1、
@vueuse/core 14.3.0 -> 14.4.0、highlight.js 11.11.1 -> 11.12.0、
vue-i18n 11.4.8 -> 11.4.10 及 unocss、sass、oxlint 等开发依赖
This commit is contained in:
parent
a85fa0aee4
commit
dd98d6ceac
52
package.json
52
package.json
@ -25,50 +25,50 @@
|
||||
"@element-plus/icons-vue": "2.3.2",
|
||||
"@highlightjs/vue-plugin": "2.1.2",
|
||||
"@iconify/vue": "^5.0.1",
|
||||
"@vueuse/core": "14.3.0",
|
||||
"@wangeditor-next/editor": "5.7.16",
|
||||
"@wangeditor-next/editor-for-vue": "5.1.14",
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
"@vueuse/core": "14.4.0",
|
||||
"@wangeditor-next/editor": "6.4.1",
|
||||
"@wangeditor-next/editor-for-vue": "6.4.1",
|
||||
"animate.css": "4.1.1",
|
||||
"await-to-js": "3.0.0",
|
||||
"axios": "1.18.1",
|
||||
"crypto-js": "4.2.0",
|
||||
"axios": "1.20.0",
|
||||
"echarts": "6.1.0",
|
||||
"element-plus": "2.14.3",
|
||||
"highlight.js": "11.11.1",
|
||||
"element-plus": "2.14.5",
|
||||
"highlight.js": "11.12.0",
|
||||
"image-conversion": "2.1.1",
|
||||
"jsencrypt": "3.5.4",
|
||||
"nprogress": "0.2.0",
|
||||
"pinia": "4.0.2",
|
||||
"vue": "3.5.40",
|
||||
"pinia": "4.0.3",
|
||||
"vue": "3.5.42",
|
||||
"vue-cropper": "1.1.4",
|
||||
"vue-i18n": "11.4.8",
|
||||
"vue-i18n": "11.4.10",
|
||||
"vue-json-pretty": "2.6.0",
|
||||
"vue-router": "5.2.0",
|
||||
"vue-router": "5.3.1",
|
||||
"vue-types": "7.0.0",
|
||||
"vxe-pc-ui": "4.16.22",
|
||||
"vxe-table": "4.20.8"
|
||||
"vxe-pc-ui": "4.18.9",
|
||||
"vxe-table": "4.21.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/crypto-js": "4.2.2",
|
||||
"@types/node": "^26.1.1",
|
||||
"@types/nprogress": "0.2.3",
|
||||
"@unocss/preset-attributify": "66.7.5",
|
||||
"@unocss/preset-wind3": "66.7.5",
|
||||
"@unocss/preset-attributify": "66.10.1",
|
||||
"@unocss/preset-wind3": "66.10.1",
|
||||
"@vitejs/plugin-vue": "^6.0.8",
|
||||
"@vue/compiler-sfc": "3.5.40",
|
||||
"autoprefixer": "10.5.4",
|
||||
"oxfmt": "^0.60.0",
|
||||
"oxlint": "^1.75.0",
|
||||
"sass": "1.102.0",
|
||||
"@vue/compiler-sfc": "3.5.42",
|
||||
"autoprefixer": "10.5.5",
|
||||
"oxfmt": "^0.67.0",
|
||||
"oxlint": "^1.82.0",
|
||||
"sass": "1.104.0",
|
||||
"typescript": "^6.0.3",
|
||||
"unocss": "66.7.5",
|
||||
"unplugin-auto-import": "21.0.0",
|
||||
"unocss": "66.10.1",
|
||||
"unplugin-auto-import": "21.1.0",
|
||||
"unplugin-vue-components": "32.1.0",
|
||||
"unplugin-vue-setup-extend-plus": "1.0.1",
|
||||
"vite": "^8.1.5",
|
||||
"vite-plugin-svg-icons-ng": "^1.9.2",
|
||||
"vitest": "4.1.10",
|
||||
"vue-tsc": "^3.3.8"
|
||||
"vite": "^8.2.2",
|
||||
"vite-plugin-svg-icons-ng": "^1.9.3",
|
||||
"vitest": "4.1.11",
|
||||
"vue-tsc": "^3.3.11"
|
||||
},
|
||||
"browserslist": [
|
||||
"Chrome >= 87",
|
||||
|
||||
2603
pnpm-lock.yaml
generated
2603
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
import * as CryptoJSModule from 'crypto-js';
|
||||
|
||||
const CryptoJS = ('default' in CryptoJSModule ? CryptoJSModule.default : CryptoJSModule) as typeof CryptoJSModule;
|
||||
import { ecb } from '@noble/ciphers/aes.js';
|
||||
|
||||
/**
|
||||
* 随机生成32位的字符串
|
||||
@ -14,41 +12,58 @@ const generateRandomString = (): string => {
|
||||
.slice(0, 32);
|
||||
};
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
const bytesToBase64 = (bytes: Uint8Array): string => {
|
||||
let binary = '';
|
||||
for (const byte of bytes) {
|
||||
binary += String.fromCharCode(byte);
|
||||
}
|
||||
return btoa(binary);
|
||||
};
|
||||
|
||||
const base64ToBytes = (str: string): Uint8Array => {
|
||||
const binary = atob(str);
|
||||
const bytes = new Uint8Array(binary.length);
|
||||
for (let i = 0; i < binary.length; i++) {
|
||||
bytes[i] = binary.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
};
|
||||
|
||||
/**
|
||||
* 随机生成aes 密钥
|
||||
* @returns {string}
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
export const generateAesKey = (): CryptoJSModule.lib.WordArray => {
|
||||
return CryptoJS.enc.Utf8.parse(generateRandomString());
|
||||
export const generateAesKey = (): Uint8Array => {
|
||||
return encoder.encode(generateRandomString());
|
||||
};
|
||||
|
||||
/**
|
||||
* 加密base64
|
||||
* @returns {string}
|
||||
*/
|
||||
export const encryptBase64 = (str: CryptoJSModule.lib.WordArray): string => {
|
||||
return CryptoJS.enc.Base64.stringify(str);
|
||||
export const encryptBase64 = (bytes: Uint8Array): string => {
|
||||
return bytesToBase64(bytes);
|
||||
};
|
||||
|
||||
/**
|
||||
* 解密base64
|
||||
*/
|
||||
export const decryptBase64 = (str: string) => {
|
||||
return CryptoJS.enc.Base64.parse(str);
|
||||
export const decryptBase64 = (str: string): Uint8Array => {
|
||||
return base64ToBytes(str);
|
||||
};
|
||||
|
||||
/**
|
||||
* 使用密钥对数据进行加密
|
||||
* 使用密钥对数据进行加密 (AES/ECB/PKCS7Padding 与后端保持一致)
|
||||
* @param message
|
||||
* @param aesKey
|
||||
* @returns {string}
|
||||
*/
|
||||
export const encryptWithAes = (message: string, aesKey: CryptoJSModule.lib.WordArray): string => {
|
||||
const encrypted = CryptoJS.AES.encrypt(message, aesKey, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return encrypted.toString();
|
||||
export const encryptWithAes = (message: string, aesKey: Uint8Array): string => {
|
||||
const encrypted = ecb(aesKey).encrypt(encoder.encode(message));
|
||||
return bytesToBase64(encrypted);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -57,10 +72,7 @@ export const encryptWithAes = (message: string, aesKey: CryptoJSModule.lib.WordA
|
||||
* @param aesKey
|
||||
* @returns {string}
|
||||
*/
|
||||
export const decryptWithAes = (message: string, aesKey: CryptoJSModule.lib.WordArray): string => {
|
||||
const decrypted = CryptoJS.AES.decrypt(message, aesKey, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return decrypted.toString(CryptoJS.enc.Utf8);
|
||||
export const decryptWithAes = (message: string, aesKey: Uint8Array): string => {
|
||||
const decrypted = ecb(aesKey).decrypt(base64ToBytes(message));
|
||||
return decoder.decode(decrypted);
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@ import createComponents from './components';
|
||||
import createSvgIconsPlugin from './svg-icon';
|
||||
import createCompression from './compression';
|
||||
import createSetupExtend from './setup-extend';
|
||||
import { viteCheckTransitionPlugin } from "./check-transition";
|
||||
import { viteCheckTransitionPlugin } from './check-transition';
|
||||
|
||||
export default (viteEnv: any, isBuild = false): [] => {
|
||||
const vitePlugins: any = [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user