yd-admin 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +6 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18,9 +18,14 @@ var __exportAll = (all, no_symbols) => {
18
18
  /**
19
19
  * Web Crypto API 加密工具
20
20
  * 使用 AES-GCM 算法进行对称加密
21
+ *
22
+ * 环境变量:
23
+ * - VITE_CRYPTO_SALT: 自定义盐值 (允许使用项目覆盖)
24
+ * 示例: VITE_CRYPTO_SALT=your-project-salt
21
25
  */
22
26
  const encoder = new TextEncoder();
23
27
  const decoder = new TextDecoder();
28
+ const CRYPTO_SALT = import.meta.env.VITE_CRYPTO_SALT || "yd-admin-salt-fixed";
24
29
  /**
25
30
  * 密钥派生缓存
26
31
  * 避免每次加密/解密都重新派生密钥 (PBKDF2 100000 次迭代开销较大)
@@ -41,7 +46,7 @@ async function deriveKey(password) {
41
46
  const cached = keyCache.get(password);
42
47
  if (cached) return cached.key;
43
48
  const keyMaterial = await crypto.subtle.importKey("raw", encoder.encode(password), { name: "PBKDF2" }, false, ["deriveKey"]);
44
- const salt = encoder.encode("yd-admin-salt-fixed");
49
+ const salt = encoder.encode(CRYPTO_SALT);
45
50
  const key = await crypto.subtle.deriveKey({
46
51
  name: "PBKDF2",
47
52
  salt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yd-admin",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "基于 Vue 3 的后台管理框架通用组件库 - 轻量、高效、主题可定制",
5
5
  "keywords": [
6
6
  "admin",