@mysterycode-liwen/dsh-credential-vault 1.5.0 → 1.5.2

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.
package/README.md CHANGED
@@ -126,6 +126,18 @@ Host 侧工具在 Harness 启动时注册。重启 Harness,或在插件管理
126
126
 
127
127
  ## 更新日志 / Changelog
128
128
 
129
+ ### 1.5.2 — 2026-11-28 — 账号关联凭据与类型改名
130
+
131
+ - **账号可关联其它凭据**:账号类型新增「关联凭据」字段,编辑时多选已有的 API Key / 密钥 / 其他凭据(不含账号自身);卡片上以可点击标签展示,点击直接跳转定位。
132
+ - **关联无损**:关联关系随 JSON / CSV / Markdown 三格式无损导回(显示为 `标题(id)`),删除凭据时自动清理其它条目对它的引用,不留死链。
133
+ - **「通用密钥」改名为「密钥」**:界面显示名全部更新,内部类型 key 保持 `secretKey`;旧导出文件中的「通用密钥」标签仍兼容识别。
134
+
135
+ ### 1.5.1 — 2026-11-28 — 新增「通用密钥」类型
136
+
137
+ - **新增凭据类型「通用密钥」**(`secretKey`):标题 + 密钥名称 + 密钥值 + 备注,适合保存零散的 token / secret / 口令,密钥值默认脱敏。
138
+ - **安全链路同步**:密钥值纳入 Host 脱敏、浏览器镜像掩码、安全审计与加密导出范围;工具 `category` 过滤新增 `secretKey`。
139
+ - **导入导出同步**:新增「密钥名称 / 密钥值」中文字段与 Card 展示,JSON / CSV / Markdown 三格式往返无损。
140
+
129
141
  ### 1.5.0 — 2026-11-26 — 微信开发凭据类型与表单改版
130
142
 
131
143
  - **新增两种凭据类型**:微信公众号(`wechatMp`)与微信小程序(`wechatMini`),字段包含 AppID、AppSecret、Token / EncodingAESKey、服务器地址、上传密钥、服务器域名等;密钥类字段默认脱敏。
@@ -180,7 +192,7 @@ Host 侧工具在 Harness 启动时注册。重启 Harness,或在插件管理
180
192
  npm run check # 发布前自检:client.js 的模块 id 与 cordis.patch.yml 的 name 必须等于包名
181
193
  npm pack --dry-run # 核对实际打包的文件清单
182
194
  npm publish # publishConfig.access = public;会先自动跑一次 npm run check,不一致则中止
183
- git tag v1.4.2 && git push --tags
195
+ git tag v1.5.2 && git push --tags
184
196
  ```
185
197
 
186
198
  `client.js` 里 `window.__ModuleLoader__.load({ id })` 的 `id` **必须等于 `package.json` 的 `name`**:DSH 按包名去浏览器模块表里查找,不一致时浏览器端不会挂载,表现为侧边栏入口与设置页整块消失(Host 端仍然正常)。改包名或改 scope 时,三处要同步:`package.json` 的 `name`、`client.js` 的 `id`、`cordis.patch.yml` 的 `name`。
package/client.js CHANGED
@@ -15,7 +15,7 @@ window.__ModuleLoader__.load({
15
15
  // whatever port the Web GUI is on.
16
16
  var API = 'dsh-credential-vault/';
17
17
  /** Plugin version shown in Settings; keep in sync with package.json on release. */
18
- var VERSION = '1.5.0';
18
+ var VERSION = '1.5.2';
19
19
 
20
20
  // Compare two semver-ish strings: -1 (left older), 0 (equal), 1 (left newer).
21
21
  // Used to decide "update available" against THIS client's version, so the
@@ -40,7 +40,7 @@ window.__ModuleLoader__.load({
40
40
  sort: 'Sort', sortRecent: 'Recently updated', sortTitle: 'Name (A–Z)', sortCategory: 'Type',
41
41
  search: 'Search name, account, URL or notes…',
42
42
  filterAll: 'All', filterAccount: 'Accounts', filterApikey: 'API keys', filterOther: 'Other',
43
- filterWechatMp: 'Official Accounts', filterWechatMini: 'Mini Programs',
43
+ filterWechatMp: 'Official Accounts', filterWechatMini: 'Mini Programs', filterSecretKey: 'Secret keys',
44
44
  localNotice: 'Stored locally in this browser (localStorage) on this device. Not synced or encrypted — avoid shared / public browsers.',
45
45
  show: 'Show', hide: 'Hide', copy: 'Copy', visit: 'Visit', copied: 'Copied to clipboard', copyFail: 'Copy failed — select the text manually',
46
46
  visitFail: 'Could not open the browser. Check the URL and try again.',
@@ -51,6 +51,7 @@ window.__ModuleLoader__.load({
51
51
  editorNew: 'New credential', editorEdit: 'Edit credential',
52
52
  fTitle: 'Name', fTitlePh: 'e.g. GitHub, Google', fTitlePhApikey: 'e.g. OpenAI, AWS, GitHub PAT', fTitlePhOther: 'e.g. Recovery codes, Wi-Fi, License',
53
53
  fTitlePhWechatMp: 'e.g. My Official Account', fTitlePhWechatMini: 'e.g. My Mini Program',
54
+ fTitlePhSecretKey: 'e.g. GitHub PAT, service token',
54
55
  fCategory: 'Type', formDetails: 'Credentials', moreFields: 'More fields', lessFields: 'Fewer fields',
55
56
  fAccount: 'Account / username', fAccountPh: 'user@example.com',
56
57
  fPassword: 'Password', fPasswordPh: 'Enter password',
@@ -61,6 +62,7 @@ window.__ModuleLoader__.load({
61
62
  fExpiry: 'Expires on (optional)',
62
63
  fContent: 'Content / secret', fContentPh: 'Recovery codes, license key, certificate, PIN…',
63
64
  fNotes: 'Notes (optional)', fNotesPh: 'Any extra info…',
65
+ fLinks: 'Linked credentials', linkNone: 'No API Key / Key / Other credentials yet', linkMissing: 'Linked credential no longer exists',
64
66
  fAppId: 'AppID', fAppIdPh: 'wx…',
65
67
  fAppSecret: 'AppSecret', fAppSecretPh: 'Application secret',
66
68
  fToken: 'Server Token', fTokenPh: 'Token from server config',
@@ -68,13 +70,16 @@ window.__ModuleLoader__.load({
68
70
  fServerUrl: 'Server URL', fServerUrlPh: 'https://… (callback URL)',
69
71
  fUploadKey: 'Code upload key', fUploadKeyPh: 'Private key used to upload mini program code',
70
72
  fDomains: 'Server domains', fDomainsPh: 'request / socket / upload / download domains',
73
+ fKeyName: 'Key name', fKeyNamePh: 'e.g. access token, webhook secret',
74
+ fKeyValue: 'Secret value', fKeyValuePh: 'Paste the token / secret / password',
71
75
  catAccount: 'Account', catApikey: 'API key', catOther: 'Other',
72
- catWechatMp: 'WeChat Official Account', catWechatMini: 'WeChat Mini Program',
76
+ catWechatMp: 'WeChat Official Account', catWechatMini: 'WeChat Mini Program', catSecretKey: 'Secret key',
73
77
  hintAccount: 'For website / app logins — username and password.',
74
78
  hintApikey: 'For platform-issued API keys, tokens and endpoints.',
75
79
  hintOther: 'For recovery codes, licenses, certificates or any free text.',
76
80
  hintWechatMp: 'For WeChat Official Account developer credentials and server config.',
77
81
  hintWechatMini: 'For WeChat Mini Program developer credentials and upload key.',
82
+ hintSecretKey: 'For miscellaneous name + value secrets — tokens, secrets, passwords.',
78
83
  save: 'Save', cancel: 'Cancel', required: 'Please enter a name',
79
84
  confirmDelete: 'Delete this credential? This cannot be undone.',
80
85
  saved: 'Saved', deleted: 'Deleted', revealAll: 'Reveal all', hideAll: 'Hide all',
@@ -165,7 +170,7 @@ window.__ModuleLoader__.load({
165
170
  sort: '排序', sortRecent: '最近更新', sortTitle: '名称(A–Z)', sortCategory: '类型',
166
171
  search: '搜索名称、账号、网址或备注…',
167
172
  filterAll: '全部', filterAccount: '账号密码', filterApikey: 'API Key', filterOther: '其他',
168
- filterWechatMp: '微信公众号', filterWechatMini: '微信小程序',
173
+ filterWechatMp: '微信公众号', filterWechatMini: '微信小程序', filterSecretKey: '密钥',
169
174
  localNotice: '数据仅保存在本机浏览器的 localStorage 中,不跨设备同步、不加密,请避免在公用/共享浏览器使用。',
170
175
  show: '显示', hide: '隐藏', copy: '复制', visit: '访问', copied: '已复制到剪贴板', copyFail: '复制失败,请手动选择文本',
171
176
  visitFail: '无法打开浏览器,请检查网址后重试。',
@@ -176,6 +181,7 @@ window.__ModuleLoader__.load({
176
181
  editorNew: '新增凭据', editorEdit: '编辑凭据',
177
182
  fTitle: '名称', fTitlePh: '例如:GitHub、Google', fTitlePhApikey: '例如:OpenAI、AWS、GitHub PAT', fTitlePhOther: '例如:恢复码、Wi-Fi、许可证',
178
183
  fTitlePhWechatMp: '例如:我的公众号', fTitlePhWechatMini: '例如:我的小程序',
184
+ fTitlePhSecretKey: '例如:GitHub PAT、服务令牌',
179
185
  fCategory: '类型', formDetails: '凭据信息', moreFields: '更多字段', lessFields: '收起字段',
180
186
  fAccount: '账号 / 用户名', fAccountPh: 'user@example.com',
181
187
  fPassword: '密码', fPasswordPh: '输入密码',
@@ -186,6 +192,7 @@ window.__ModuleLoader__.load({
186
192
  fExpiry: '到期日期(可选)',
187
193
  fContent: '内容 / 密钥', fContentPh: '恢复码、许可证、证书、PIN…',
188
194
  fNotes: '备注(可选)', fNotesPh: '其他信息…',
195
+ fLinks: '关联凭据', linkNone: '还没有 API Key / 密钥 / 其他凭据', linkMissing: '关联的凭据已不存在',
189
196
  fAppId: 'AppID', fAppIdPh: 'wx…',
190
197
  fAppSecret: 'AppSecret', fAppSecretPh: '应用密钥',
191
198
  fToken: '服务器 Token', fTokenPh: '服务器配置里的 Token',
@@ -193,13 +200,16 @@ window.__ModuleLoader__.load({
193
200
  fServerUrl: '服务器地址', fServerUrlPh: 'https://…(回调地址)',
194
201
  fUploadKey: '代码上传密钥', fUploadKeyPh: '上传小程序代码用的私钥',
195
202
  fDomains: '服务器域名', fDomainsPh: 'request / socket / upload / download 合法域名',
203
+ fKeyName: '密钥名称', fKeyNamePh: '例如:访问令牌、Webhook 密钥',
204
+ fKeyValue: '密钥值', fKeyValuePh: '粘贴令牌 / 密钥 / 口令',
196
205
  catAccount: '账号密码', catApikey: 'API Key', catOther: '其他',
197
- catWechatMp: '微信公众号', catWechatMini: '微信小程序',
206
+ catWechatMp: '微信公众号', catWechatMini: '微信小程序', catSecretKey: '密钥',
198
207
  hintAccount: '用于保存网站 / 应用的登录账号与密码。',
199
208
  hintApikey: '用于保存平台签发的 API Key、令牌与接口地址。',
200
209
  hintOther: '用于保存恢复码、许可证、证书等任意文本。',
201
210
  hintWechatMp: '用于保存公众号开发者凭证与服务器配置。',
202
211
  hintWechatMini: '用于保存小程序开发者凭证与代码上传密钥。',
212
+ hintSecretKey: '用于保存零散的名称 + 值型密钥:令牌、密钥、口令等。',
203
213
  save: '保存', cancel: '取消', required: '请输入名称',
204
214
  confirmDelete: '确定删除这条凭据?此操作不可撤销。',
205
215
  saved: '已保存', deleted: '已删除', revealAll: '全部显示', hideAll: '全部隐藏',
@@ -295,6 +305,7 @@ window.__ModuleLoader__.load({
295
305
  { key: 'username', label: 'fAccount', ph: 'fAccountPh', type: 'text', mono: true },
296
306
  { key: 'password', label: 'fPassword', ph: 'fPasswordPh', type: 'secret', mono: true, generatable: true },
297
307
  { key: 'url', label: 'fUrl', ph: 'fUrlPh', type: 'text', isUrl: true },
308
+ { key: 'links', label: 'fLinks', type: 'links' },
298
309
  { key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
299
310
  ],
300
311
  apikey: [
@@ -305,6 +316,12 @@ window.__ModuleLoader__.load({
305
316
  { key: 'expiry', label: 'fExpiry', type: 'date' },
306
317
  { key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
307
318
  ],
319
+ secretKey: [
320
+ { key: 'title', label: 'fTitle', ph: 'fTitlePhSecretKey', type: 'text', required: true },
321
+ { key: 'keyName', label: 'fKeyName', ph: 'fKeyNamePh', type: 'text', mono: true },
322
+ { key: 'keyValue', label: 'fKeyValue', ph: 'fKeyValuePh', type: 'secret', mono: true },
323
+ { key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
324
+ ],
308
325
  other: [
309
326
  { key: 'title', label: 'fTitle', ph: 'fTitlePhOther', type: 'text', required: true },
310
327
  { key: 'content', label: 'fContent', ph: 'fContentPh', type: 'secretarea', mono: true },
@@ -335,6 +352,7 @@ window.__ModuleLoader__.load({
335
352
  { k: 'apikey', label: 'catApikey', hint: 'hintApikey' },
336
353
  { k: 'wechatMp', label: 'catWechatMp', hint: 'hintWechatMp' },
337
354
  { k: 'wechatMini', label: 'catWechatMini', hint: 'hintWechatMini' },
355
+ { k: 'secretKey', label: 'catSecretKey', hint: 'hintSecretKey' },
338
356
  { k: 'other', label: 'catOther', hint: 'hintOther' }
339
357
  ];
340
358
  var FILTERS = [
@@ -343,6 +361,7 @@ window.__ModuleLoader__.load({
343
361
  { k: 'apikey', label: 'filterApikey' },
344
362
  { k: 'wechatMp', label: 'filterWechatMp' },
345
363
  { k: 'wechatMini', label: 'filterWechatMini' },
364
+ { k: 'secretKey', label: 'filterSecretKey' },
346
365
  { k: 'other', label: 'filterOther' }
347
366
  ];
348
367
  function schemaOf(cat) { return SCHEMAS[cat] || SCHEMAS.account; }
@@ -408,6 +427,13 @@ window.__ModuleLoader__.load({
408
427
  '.cv-badge-other{background:var(--cv-l2);color:var(--cv-t2)}',
409
428
  '.cv-badge-wechatMp{background:#07c160;color:#fff}',
410
429
  '.cv-badge-wechatMini{background:#10aec2;color:#fff}',
430
+ '.cv-badge-secretKey{background:#8b5cf6;color:#fff}',
431
+ '.cv-links{margin:10px 0 2px;padding-top:8px;border-top:1px dashed var(--cv-b1)}',
432
+ '.cv-link-chip{display:inline-flex;align-items:center;gap:3px;margin:3px 5px 0 0;padding:4px 9px;border:1px solid var(--cv-b1);border-radius:999px;background:var(--cv-l2);color:var(--cv-brand);font-size:11.5px;cursor:pointer;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
433
+ '.cv-link-chip:hover{border-color:var(--cv-brand)}',
434
+ '.cv-link-options{max-height:170px;overflow:auto;border:1px solid var(--cv-b1);border-radius:8px;padding:6px 9px;background:var(--cv-bg)}',
435
+ '.cv-link-opt{display:flex;align-items:center;gap:7px;padding:4px 0;font-size:12.5px;cursor:pointer}',
436
+ '.cv-link-empty{font-size:12px;color:var(--cv-t2)}',
411
437
  '.cv-card-title{font-weight:600;font-size:14.5px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
412
438
  '.cv-card-actions{display:flex;gap:4px}',
413
439
  '.cv-icon-btn{width:28px;height:28px;border-radius:7px;border:1px solid transparent;background:transparent;color:var(--cv-t2);cursor:pointer;font-size:14px;line-height:1;display:flex;align-items:center;justify-content:center}',
@@ -545,12 +571,24 @@ window.__ModuleLoader__.load({
545
571
  if (n.secret != null && n.password == null && n.apiKey == null && n.content == null) {
546
572
  if (n.category === 'apikey') n.apiKey = n.secret;
547
573
  else if (n.category === 'other') n.content = n.secret;
574
+ else if (n.category === 'secretKey') n.keyValue = n.secret;
548
575
  else n.password = n.secret;
549
576
  }
550
577
  if (n.category === 'apikey') {
551
578
  if (n.provider == null && n.username) n.provider = n.username;
552
579
  if (n.endpoint == null && n.url) n.endpoint = n.url;
553
580
  }
581
+ // Links are credential IDs. Accept arrays, the human-readable "Title(id)"
582
+ // form used in CSV/Markdown exports, and the legacy comma-separated form.
583
+ if (Array.isArray(n.links)) {
584
+ n.links = n.links.map(function (x) { return String(x); }).filter(Boolean);
585
+ } else if (typeof n.links === 'string' && n.links.trim()) {
586
+ var ids = [], lm, lre = /[((]([^())]+)[))]/g;
587
+ while ((lm = lre.exec(n.links)) !== null) ids.push(lm[1].trim());
588
+ n.links = ids.length ? ids : n.links.split(/[,,、]/).map(function (x) { return x.trim(); }).filter(Boolean);
589
+ } else {
590
+ delete n.links;
591
+ }
554
592
  return sanitize(n);
555
593
  }
556
594
  function loadEntries() {
@@ -577,9 +615,9 @@ window.__ModuleLoader__.load({
577
615
  // Fire-and-forget: the browser stays usable even if the Host route is down.
578
616
  // Large vaults: DEBOUNCE so a burst of edits results in one POST, not dozens
579
617
  // of multi-megabyte payloads. A trailing timer always flushes the latest data.
580
- var MIRROR_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'url', 'endpoint', 'expiry',
581
- 'appId', 'serverUrl', 'domains', 'notes', 'createdAt', 'updatedAt'];
582
- var MIRROR_SECRETS = ['password', 'apiKey', 'content', 'appSecret', 'token', 'encodingAesKey', 'uploadKey'];
618
+ var MIRROR_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'keyName', 'url', 'endpoint', 'expiry',
619
+ 'appId', 'serverUrl', 'domains', 'notes', 'links', 'createdAt', 'updatedAt'];
620
+ var MIRROR_SECRETS = ['password', 'apiKey', 'content', 'appSecret', 'token', 'encodingAesKey', 'uploadKey', 'keyValue'];
583
621
  function toEnvelope(entry) {
584
622
  var out = {};
585
623
  MIRROR_FIELDS.forEach(function (k) {
@@ -682,6 +720,7 @@ window.__ModuleLoader__.load({
682
720
  var cat = e.category || 'account';
683
721
  if (cat === 'apikey') return String(e.apiKey || '');
684
722
  if (cat === 'other') return String(e.content || '');
723
+ if (cat === 'secretKey') return String(e.keyValue || '');
685
724
  return String(e.password || '');
686
725
  }
687
726
  function runAudit(entries) {
@@ -754,9 +793,9 @@ window.__ModuleLoader__.load({
754
793
  function pad(n) { return n < 10 ? '0' + n : '' + n; }
755
794
  return d.getFullYear() + pad(d.getMonth() + 1) + pad(d.getDate()) + '-' + pad(d.getHours()) + pad(d.getMinutes());
756
795
  }
757
- var EXPORT_COLS = ['id', 'title', 'category', 'username', 'password', 'url', 'provider', 'apiKey', 'endpoint', 'expiry', 'content',
796
+ var EXPORT_COLS = ['id', 'title', 'category', 'username', 'password', 'url', 'provider', 'apiKey', 'endpoint', 'expiry', 'content', 'keyName', 'keyValue',
758
797
  'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'uploadKey', 'domains',
759
- 'notes', 'createdAt', 'updatedAt'];
798
+ 'notes', 'links', 'createdAt', 'updatedAt'];
760
799
 
761
800
  // ---- Human-readable labels ------------------------------------------------
762
801
  // CSV/Markdown use Chinese labels for people; every label maps back to its
@@ -764,22 +803,24 @@ window.__ModuleLoader__.load({
764
803
  var FIELD_LABELS = {
765
804
  id: 'ID', title: '标题', category: '类型', username: '用户名', password: '密码',
766
805
  url: '网址', provider: '服务商', apiKey: 'API Key', endpoint: '接口地址',
767
- expiry: '有效期', content: '内容',
806
+ expiry: '有效期', content: '内容', keyName: '密钥名称', keyValue: '密钥值',
768
807
  appId: 'AppID', appSecret: 'AppSecret', token: '服务器Token', encodingAesKey: 'EncodingAESKey',
769
808
  serverUrl: '服务器地址', uploadKey: '代码上传密钥', domains: '服务器域名',
770
- notes: '备注', createdAt: '创建时间', updatedAt: '更新时间'
809
+ notes: '备注', links: '关联凭据', createdAt: '创建时间', updatedAt: '更新时间'
771
810
  };
772
811
  var LABEL_FIELDS = {};
773
812
  Object.keys(FIELD_LABELS).forEach(function (k) { LABEL_FIELDS[FIELD_LABELS[k]] = k; });
774
- var CATEGORY_LABELS = { account: '账号', apikey: 'API Key', other: '其他', wechatMp: '微信公众号', wechatMini: '微信小程序' };
813
+ var CATEGORY_LABELS = { account: '账号', apikey: 'API Key', secretKey: '密钥', other: '其他', wechatMp: '微信公众号', wechatMini: '微信小程序' };
775
814
  var LABEL_CATEGORIES = {};
776
815
  Object.keys(CATEGORY_LABELS).forEach(function (k) { LABEL_CATEGORIES[CATEGORY_LABELS[k]] = k; });
816
+ LABEL_CATEGORIES['通用密钥'] = 'secretKey'; // legacy exports before the rename
777
817
  // Only export fields that belong to the entry's type. A record may carry
778
818
  // stale fields from a past type change (e.g. an API Key with leftover
779
819
  // username/password/url); those must not leak into readable exports.
780
820
  var VISIBLE_FIELDS = {
781
- account: ['title', 'username', 'password', 'url', 'notes'],
821
+ account: ['title', 'username', 'password', 'url', 'links', 'notes'],
782
822
  apikey: ['title', 'provider', 'apiKey', 'endpoint', 'expiry', 'notes'],
823
+ secretKey: ['title', 'keyName', 'keyValue', 'notes'],
783
824
  other: ['title', 'content', 'notes'],
784
825
  wechatMp: ['title', 'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'notes'],
785
826
  wechatMini: ['title', 'appId', 'appSecret', 'uploadKey', 'domains', 'notes']
@@ -809,12 +850,20 @@ window.__ModuleLoader__.load({
809
850
  var d = new Date(Number(v));
810
851
  return isNaN(d.getTime()) ? String(v) : d.toISOString();
811
852
  }
853
+ // Render links as "Linked title(id)" so exports stay readable AND re-importable.
854
+ function formatLinks(links, arr) {
855
+ if (!Array.isArray(links) || !links.length) return '';
856
+ return links.map(function (id) {
857
+ var target = arr.filter(function (x) { return x.id === id; })[0];
858
+ return target && target.title ? target.title + '(' + id + ')' : String(id);
859
+ }).join('、');
860
+ }
812
861
  // CSV shows the fields people actually read first; technical columns
813
862
  // (ID / timestamps) go last. Import maps by header label, so order is safe.
814
863
  var CSV_COLS = ['title', 'category', 'username', 'password', 'url', 'provider',
815
- 'apiKey', 'endpoint', 'expiry', 'content',
864
+ 'apiKey', 'endpoint', 'expiry', 'content', 'keyName', 'keyValue',
816
865
  'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'uploadKey', 'domains',
817
- 'notes', 'id', 'createdAt', 'updatedAt'];
866
+ 'notes', 'links', 'id', 'createdAt', 'updatedAt'];
818
867
  function buildCsv(arr) {
819
868
  var lines = [CSV_COLS.map(function (c) { return csvEscape(FIELD_LABELS[c] || c); }).join(',')];
820
869
  arr.forEach(function (e) {
@@ -825,6 +874,7 @@ window.__ModuleLoader__.load({
825
874
  // do not belong to this type are left blank.
826
875
  if (visible.indexOf(c) < 0 && c !== 'id' && c !== 'category' && c !== 'createdAt' && c !== 'updatedAt') return '';
827
876
  var v = (c === 'createdAt' || c === 'updatedAt') ? csvDate(n[c]) : n[c];
877
+ if (c === 'links') v = formatLinks(n.links, arr);
828
878
  if (c === 'category') v = CATEGORY_LABELS[v] || v;
829
879
  return csvEscape(v);
830
880
  }).join(','));
@@ -939,6 +989,7 @@ window.__ModuleLoader__.load({
939
989
  fieldsFor(n.category).forEach(function (c) {
940
990
  if (c === 'title') return;
941
991
  var v = n[c];
992
+ if (c === 'links') v = formatLinks(n.links, arr);
942
993
  if (v == null || v === '') return;
943
994
  lines.push('| ' + (FIELD_LABELS[c] || c) + ' | ' + mdCell(v) + ' |');
944
995
  });
@@ -1277,7 +1328,8 @@ window.__ModuleLoader__.load({
1277
1328
  id: '', title: '', category: cat || 'account',
1278
1329
  username: '', password: '', url: '',
1279
1330
  provider: '', apiKey: '', endpoint: '', expiry: '',
1280
- content: '',
1331
+ content: '', keyName: '', keyValue: '',
1332
+ links: [],
1281
1333
  appId: '', appSecret: '', token: '', encodingAesKey: '', serverUrl: '', uploadKey: '', domains: '',
1282
1334
  notes: ''
1283
1335
  };
@@ -1344,6 +1396,15 @@ window.__ModuleLoader__.load({
1344
1396
  var cat = e.category || 'account';
1345
1397
  var catMeta = CATEGORIES.filter(function (c) { return c.k === cat; })[0];
1346
1398
  var catLabel = catMeta ? t(catMeta.label) : t('catAccount');
1399
+ var linkChips = Array.isArray(e.links) && e.links.length ? e.links.map(function (id) {
1400
+ var target = (props.entries || []).filter(function (x) { return x.id === id; })[0];
1401
+ if (!target) return null;
1402
+ var tc = CATEGORIES.filter(function (c) { return c.k === target.category; })[0];
1403
+ return h('button', {
1404
+ key: id, className: 'cv-link-chip', title: target.title,
1405
+ onClick: function () { props.onGo(id); }
1406
+ }, '🔗 ' + target.title + (tc ? ' · ' + t(tc.label) : ''));
1407
+ }).filter(Boolean) : [];
1347
1408
  return h('div', { className: 'cv-card' },
1348
1409
  h('div', { className: 'cv-card-head' },
1349
1410
  h('span', { className: 'cv-badge cv-badge-' + cat }, catLabel),
@@ -1355,13 +1416,16 @@ window.__ModuleLoader__.load({
1355
1416
  ),
1356
1417
  h('div', { className: 'cv-card-body' },
1357
1418
  schemaOf(cat).slice(1).map(function (f) {
1419
+ if (f.key === 'links') return null;
1358
1420
  if (!e[f.key]) return null;
1359
1421
  return h(Field, {
1360
1422
  key: f.key, t: t, label: f.label, value: e[f.key],
1361
1423
  mono: !!f.mono, secret: isSecretField(f), multiline: isMultilineField(f), isUrl: !!f.isUrl,
1362
1424
  revealed: !!props.revealed, onToggle: props.onToggle, onCopy: props.onCopy, onVisit: props.onVisit
1363
1425
  });
1364
- })
1426
+ }),
1427
+ linkChips.length ? h('div', { className: 'cv-links' },
1428
+ h('div', { className: 'cv-field-label' }, t('fLinks')), linkChips) : null
1365
1429
  )
1366
1430
  );
1367
1431
  }
@@ -1375,7 +1439,7 @@ window.__ModuleLoader__.load({
1375
1439
 
1376
1440
  // Only the essential fields show by default; the rest fold behind a
1377
1441
  // "More fields" toggle so short forms stay short and long forms compact.
1378
- var PRIMARY_KEYS = { title: 1, username: 1, password: 1, apiKey: 1, appId: 1, appSecret: 1, content: 1 };
1442
+ var PRIMARY_KEYS = { title: 1, username: 1, password: 1, apiKey: 1, appId: 1, appSecret: 1, content: 1, keyName: 1, keyValue: 1, links: 1 };
1379
1443
  var primary = fields.filter(function (f) { return PRIMARY_KEYS[f.key]; });
1380
1444
  var secondary = fields.filter(function (f) { return !PRIMARY_KEYS[f.key]; });
1381
1445
  var hasSecondary = secondary.some(function (f) { return !!d[f.key]; });
@@ -1390,11 +1454,32 @@ window.__ModuleLoader__.load({
1390
1454
  }, extra || {});
1391
1455
  }
1392
1456
  // Multiline fields and long values get a full row; everything else pairs up.
1393
- var WIDE_KEYS = { content: 1, notes: 1, endpoint: 1, serverUrl: 1, uploadKey: 1, domains: 1, encodingAesKey: 1 };
1457
+ var WIDE_KEYS = { content: 1, notes: 1, endpoint: 1, serverUrl: 1, uploadKey: 1, domains: 1, encodingAesKey: 1, links: 1 };
1394
1458
  function isWide(f) { return f.type === 'textarea' || f.type === 'secretarea' || !!WIDE_KEYS[f.key]; }
1395
1459
  function renderField(f) {
1396
1460
  var control;
1397
- if (f.type === 'text' || f.type === 'date') {
1461
+ if (f.type === 'links') {
1462
+ var candidates = (props.entries || []).filter(function (x) {
1463
+ return x.id !== d.id && ['apikey', 'secretKey', 'other'].indexOf(x.category) >= 0;
1464
+ });
1465
+ var selected = Array.isArray(d.links) ? d.links : [];
1466
+ control = h('div', { className: 'cv-link-options' },
1467
+ candidates.length ? candidates.map(function (x) {
1468
+ var checked = selected.indexOf(x.id) >= 0;
1469
+ var cm = CATEGORIES.filter(function (c) { return c.k === x.category; })[0];
1470
+ return h('label', { key: x.id, className: 'cv-link-opt' },
1471
+ h('input', {
1472
+ type: 'checkbox', checked: checked,
1473
+ onChange: function () {
1474
+ var next = checked ? selected.filter(function (lid) { return lid !== x.id; }) : selected.concat([x.id]);
1475
+ onChange('links', next);
1476
+ }
1477
+ }),
1478
+ h('span', null, x.title + (cm ? ' · ' + t(cm.label) : ''))
1479
+ );
1480
+ }) : h('span', { className: 'cv-link-empty' }, t('linkNone'))
1481
+ );
1482
+ } else if (f.type === 'text' || f.type === 'date') {
1398
1483
  control = h('input', baseInput(f, { type: f.type === 'date' ? 'date' : 'text' }));
1399
1484
  } else if (f.type === 'textarea') {
1400
1485
  control = h('textarea', baseInput(f, { className: 'cv-input cv-textarea' }));
@@ -2422,7 +2507,12 @@ window.__ModuleLoader__.load({
2422
2507
  }
2423
2508
  function delEntry(id) {
2424
2509
  if (!window.confirm(t('confirmDelete'))) return;
2425
- setEntries(function (prev) { return prev.filter(function (x) { return x.id !== id; }); });
2510
+ setEntries(function (prev) {
2511
+ return prev.filter(function (x) { return x.id !== id; }).map(function (x) {
2512
+ if (!Array.isArray(x.links) || x.links.indexOf(id) < 0) return x;
2513
+ return Object.assign({}, x, { links: x.links.filter(function (lid) { return lid !== id; }) });
2514
+ });
2515
+ });
2426
2516
  setToast(t('deleted'));
2427
2517
  }
2428
2518
  function doExport() {
@@ -2456,6 +2546,12 @@ window.__ModuleLoader__.load({
2456
2546
  setGenTarget(null);
2457
2547
  setToast(t('copied'));
2458
2548
  }
2549
+ function goToEntry(id) {
2550
+ var target = entries.filter(function (x) { return x.id === id; })[0];
2551
+ if (!target) { setToast(t('linkMissing')); return; }
2552
+ setFilter('all');
2553
+ setQuery(target.title || '');
2554
+ }
2459
2555
  function auditEditEntry(id) {
2460
2556
  var e = entries.filter(function (x) { return x.id === id; })[0];
2461
2557
  setAuditing(false);
@@ -2532,6 +2628,7 @@ window.__ModuleLoader__.load({
2532
2628
  : list.map(function (e) {
2533
2629
  return h(Card, {
2534
2630
  key: e.id, entry: e, t: t, revealed: !!revealed[e.id],
2631
+ entries: entries, onGo: goToEntry,
2535
2632
  onToggle: function () { toggleReveal(e.id); },
2536
2633
  onEdit: function () { openEdit(e); },
2537
2634
  onDelete: function () { delEntry(e.id); },
@@ -2544,6 +2641,7 @@ window.__ModuleLoader__.load({
2544
2641
  ),
2545
2642
  editing ? h(EditorModal, {
2546
2643
  t: t, draft: editing.draft, titleKey: editing.mode === 'new' ? 'editorNew' : 'editorEdit',
2644
+ entries: entries,
2547
2645
  onChange: setDraftField, onSave: saveDraft, onCancel: function () { setEditing(null); },
2548
2646
  onGenerate: function (field) { setGenTarget({ field: field }); }
2549
2647
  }) : null,
package/cordis.patch.yml CHANGED
@@ -1,3 +1,3 @@
1
- - insert:
2
- - id: dsh-credential-vault
3
- name: '@mysterycode-liwen/dsh-credential-vault'
1
+ - insert:
2
+ - id: dsh-credential-vault
3
+ name: '@mysterycode-liwen/dsh-credential-vault'
package/icon.svg CHANGED
@@ -1,6 +1,6 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
- <rect width="64" height="64" rx="14" fill="#2563eb"/>
3
- <path d="M32 14 L46 19.5 V31 C46 40.5 39.8 46.8 32 50 C24.2 46.8 18 40.5 18 31 V19.5 Z" fill="#ffffff" opacity="0.96"/>
4
- <circle cx="32" cy="29.5" r="4.3" fill="#2563eb"/>
5
- <rect x="29.8" y="32.5" width="4.4" height="8.5" rx="2.2" fill="#2563eb"/>
6
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <rect width="64" height="64" rx="14" fill="#2563eb"/>
3
+ <path d="M32 14 L46 19.5 V31 C46 40.5 39.8 46.8 32 50 C24.2 46.8 18 40.5 18 31 V19.5 Z" fill="#ffffff" opacity="0.96"/>
4
+ <circle cx="32" cy="29.5" r="4.3" fill="#2563eb"/>
5
+ <rect x="29.8" y="32.5" width="4.4" height="8.5" rx="2.2" fill="#2563eb"/>
6
+ </svg>
package/index.js CHANGED
@@ -35,7 +35,7 @@ const MAX_BODY_BYTES = 16 * 1024 * 1024
35
35
  const MAX_ENTRIES = 20000
36
36
 
37
37
  /** Fields that hold secrets; masked by default in tool output. */
38
- const SECRET_FIELDS = ['password', 'apiKey', 'content', 'appSecret', 'token', 'encodingAesKey', 'uploadKey']
38
+ const SECRET_FIELDS = ['password', 'apiKey', 'content', 'appSecret', 'token', 'encodingAesKey', 'uploadKey', 'keyValue']
39
39
  const MASK = '••••••••'
40
40
 
41
41
  /** Pagination defaults / limits for the read tool. */
@@ -46,7 +46,7 @@ const MAX_LIMIT = 200
46
46
  const SUMMARY_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'expiry', 'updatedAt']
47
47
 
48
48
  /** Current plugin version. Keep in sync with package.json when releasing. */
49
- const CURRENT_VERSION = '1.5.0'
49
+ const CURRENT_VERSION = '1.5.2'
50
50
 
51
51
  /** Where update checks read the latest published version from (GitHub Releases latest). */
52
52
  const RELEASES_API = 'https://api.github.com/repos/mysterycode-liwen/dsh-credential-vault/releases/latest'
@@ -62,8 +62,8 @@ let snapshot = { entries: [], updatedAt: 0 }
62
62
  * Fields mirrored from the browser. Everything else (especially SECRET_FIELDS)
63
63
  * is dropped, so the Host can never hold a plaintext password / key / body.
64
64
  */
65
- const META_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'url', 'endpoint', 'expiry',
66
- 'appId', 'serverUrl', 'domains', 'notes', 'createdAt', 'updatedAt']
65
+ const META_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'keyName', 'url', 'endpoint', 'expiry',
66
+ 'appId', 'serverUrl', 'domains', 'notes', 'links', 'createdAt', 'updatedAt']
67
67
 
68
68
  /**
69
69
  * Force every incoming entry into a metadata-only shape. Applied defensively on
@@ -331,7 +331,7 @@ export function apply(ctx) {
331
331
  },
332
332
  category: {
333
333
  type: 'string',
334
- enum: ['all', 'account', 'apikey', 'other', 'wechatMp', 'wechatMini'],
334
+ enum: ['all', 'account', 'apikey', 'secretKey', 'other', 'wechatMp', 'wechatMini'],
335
335
  description: 'Only return entries of this category. Defaults to all.',
336
336
  },
337
337
  mode: {
@@ -404,7 +404,7 @@ export function apply(ctx) {
404
404
  name: 'tool:dsh-credential-vault',
405
405
  order: 118,
406
406
  text:
407
- '凭据保险箱:用户把账号密码、API Key、微信公众号 / 小程序开发信息、恢复码等保存在侧边栏「凭据保险箱」里。需要知道有哪些凭据时用 dsh_credential_vault_read 工具(按 query / category 过滤,category 可选 account / apikey / other / wechatMp / wechatMini;数据多时先用 mode="summary" 看标题清单,再用 limit/offset 翻页)。出于安全,该工具只返回元数据——密码 / API Key / AppSecret / Token / 上传密钥等一律显示为 ••••••••,明文只留在浏览器内、不会进入模型上下文,revealSecrets 参数已失效。不要向用户索要明文密钥;需要用到具体密钥时,请让用户自行在侧边栏面板中查看或复制。',
407
+ '凭据保险箱:用户把账号密码、API Key、微信公众号 / 小程序开发信息、密钥、恢复码等保存在侧边栏「凭据保险箱」里。需要知道有哪些凭据时用 dsh_credential_vault_read 工具(按 query / category 过滤,category 可选 account / apikey / secretKey / other / wechatMp / wechatMini;数据多时先用 mode="summary" 看标题清单,再用 limit/offset 翻页)。出于安全,该工具只返回元数据——密码 / API Key / 密钥值 / AppSecret / Token / 上传密钥等一律显示为 ••••••••,明文只留在浏览器内、不会进入模型上下文,revealSecrets 参数已失效。不要向用户索要明文密钥;需要用到具体密钥时,请让用户自行在侧边栏面板中查看或复制。',
408
408
  })
409
409
  return () => {}
410
410
  }, 'dsh-credential-vault-prompt')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysterycode-liwen/dsh-credential-vault",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "DeepSeek Harness 侧边栏凭据保险箱:本地保存账号密码、API Key 与恢复码,支持访问密码、密保重置、闲置自动锁定,并提供默认脱敏的 Agent 读取工具。",