dsh-vault 1.7.1 → 1.8.0-rc.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/lib/client.js +127 -87
- package/lib/client.js.map +1 -1
- package/lib/index.js +18 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -17,89 +17,89 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
document.head.appendChild(tag);
|
|
18
18
|
}
|
|
19
19
|
var VaultSection_module_css_default = {
|
|
20
|
-
"resultCount": "t_j5va_resultCount",
|
|
21
|
-
"copied": "t_j5va_copied",
|
|
22
|
-
"genOptRow": "t_j5va_genOptRow",
|
|
23
|
-
"srOnly": "t_j5va_srOnly",
|
|
24
|
-
"rowExpired": "t_j5va_rowExpired",
|
|
25
|
-
"badgeOk": "t_j5va_badgeOk",
|
|
26
20
|
"dangerButton": "t_j5va_dangerButton",
|
|
21
|
+
"tabs": "t_j5va_tabs",
|
|
22
|
+
"emptyHint": "t_j5va_emptyHint",
|
|
23
|
+
"detailItem": "t_j5va_detailItem",
|
|
24
|
+
"genOpts": "t_j5va_genOpts",
|
|
25
|
+
"row": "t_j5va_row",
|
|
26
|
+
"modeAsk": "t_j5va_modeAsk",
|
|
27
|
+
"editor": "t_j5va_editor",
|
|
28
|
+
"error": "t_j5va_error",
|
|
29
|
+
"lockedTag": "t_j5va_lockedTag",
|
|
30
|
+
"detailBox": "t_j5va_detailBox",
|
|
31
|
+
"saveButton": "t_j5va_saveButton",
|
|
27
32
|
"checkField": "t_j5va_checkField",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
33
|
+
"reportLine": "t_j5va_reportLine",
|
|
34
|
+
"tab": "t_j5va_tab",
|
|
35
|
+
"pwFair": "t_j5va_pwFair",
|
|
36
|
+
"copied": "t_j5va_copied",
|
|
37
|
+
"rowExpired": "t_j5va_rowExpired",
|
|
38
|
+
"section": "t_j5va_section",
|
|
39
|
+
"healthBar": "t_j5va_healthBar",
|
|
40
|
+
"badge": "t_j5va_badge",
|
|
41
|
+
"revealButton": "t_j5va_revealButton",
|
|
42
|
+
"rowDue": "t_j5va_rowDue",
|
|
43
|
+
"totp": "t_j5va_totp",
|
|
44
|
+
"totpRing": "t_j5va_totpRing",
|
|
45
|
+
"empty": "t_j5va_empty",
|
|
46
|
+
"list": "t_j5va_list",
|
|
47
|
+
"intro": "t_j5va_intro",
|
|
48
|
+
"modeAuto": "t_j5va_modeAuto",
|
|
49
|
+
"emptyBox": "t_j5va_emptyBox",
|
|
50
|
+
"field": "t_j5va_field",
|
|
51
|
+
"editorBody": "t_j5va_editorBody",
|
|
52
|
+
"secretField": "t_j5va_secretField",
|
|
30
53
|
"pinStar": "t_j5va_pinStar",
|
|
54
|
+
"reportTitle": "t_j5va_reportTitle",
|
|
55
|
+
"dupGroup": "t_j5va_dupGroup",
|
|
31
56
|
"auditRow": "t_j5va_auditRow",
|
|
57
|
+
"retryButton": "t_j5va_retryButton",
|
|
58
|
+
"genHist": "t_j5va_genHist",
|
|
59
|
+
"identity": "t_j5va_identity",
|
|
60
|
+
"tabPane": "t_j5va_tabPane",
|
|
61
|
+
"policyField": "t_j5va_policyField",
|
|
62
|
+
"addButton": "t_j5va_addButton",
|
|
32
63
|
"searchBox": "t_j5va_searchBox",
|
|
33
|
-
"
|
|
64
|
+
"resultCount": "t_j5va_resultCount",
|
|
65
|
+
"scoreRing": "t_j5va_scoreRing",
|
|
66
|
+
"pwStrong": "t_j5va_pwStrong",
|
|
67
|
+
"uriCode": "t_j5va_uriCode",
|
|
68
|
+
"trashButton": "t_j5va_trashButton",
|
|
69
|
+
"badgeWarn": "t_j5va_badgeWarn",
|
|
70
|
+
"rowMain": "t_j5va_rowMain",
|
|
34
71
|
"lockedBanner": "t_j5va_lockedBanner",
|
|
35
|
-
"footer": "t_j5va_footer",
|
|
36
|
-
"detailItem": "t_j5va_detailItem",
|
|
37
|
-
"dupGroup": "t_j5va_dupGroup",
|
|
38
|
-
"reportBox": "t_j5va_reportBox",
|
|
39
|
-
"totpRing": "t_j5va_totpRing",
|
|
40
72
|
"dupNames": "t_j5va_dupNames",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"healthBar": "t_j5va_healthBar",
|
|
46
|
-
"intro": "t_j5va_intro",
|
|
47
|
-
"tabPane": "t_j5va_tabPane",
|
|
48
|
-
"badge": "t_j5va_badge",
|
|
49
|
-
"pwFair": "t_j5va_pwFair",
|
|
50
|
-
"editor": "t_j5va_editor",
|
|
73
|
+
"dupMerge": "t_j5va_dupMerge",
|
|
74
|
+
"toolbar": "t_j5va_toolbar",
|
|
75
|
+
"dueBadge": "t_j5va_dueBadge",
|
|
76
|
+
"sortButton": "t_j5va_sortButton",
|
|
51
77
|
"modeReadonly": "t_j5va_modeReadonly",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
78
|
+
"kindChip": "t_j5va_kindChip",
|
|
79
|
+
"reportBox": "t_j5va_reportBox",
|
|
80
|
+
"badgeDanger": "t_j5va_badgeDanger",
|
|
81
|
+
"genOptRow": "t_j5va_genOptRow",
|
|
82
|
+
"pwLabel": "t_j5va_pwLabel",
|
|
83
|
+
"editorActions": "t_j5va_editorActions",
|
|
84
|
+
"reportSub": "t_j5va_reportSub",
|
|
85
|
+
"highBadge": "t_j5va_highBadge",
|
|
86
|
+
"badgeOk": "t_j5va_badgeOk",
|
|
87
|
+
"srOnly": "t_j5va_srOnly",
|
|
88
|
+
"kindIcon": "t_j5va_kindIcon",
|
|
58
89
|
"kindFilter": "t_j5va_kindFilter",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
90
|
+
"footer": "t_j5va_footer",
|
|
91
|
+
"status": "t_j5va_status",
|
|
92
|
+
"rowActions": "t_j5va_rowActions",
|
|
93
|
+
"title": "t_j5va_title",
|
|
61
94
|
"deleteButton": "t_j5va_deleteButton",
|
|
62
|
-
"genOpts": "t_j5va_genOpts",
|
|
63
|
-
"pwBar": "t_j5va_pwBar",
|
|
64
|
-
"tab": "t_j5va_tab",
|
|
65
|
-
"rowDue": "t_j5va_rowDue",
|
|
66
|
-
"kindIcon": "t_j5va_kindIcon",
|
|
67
|
-
"pwStrong": "t_j5va_pwStrong",
|
|
68
|
-
"trashButton": "t_j5va_trashButton",
|
|
69
|
-
"kindChip": "t_j5va_kindChip",
|
|
70
95
|
"pwWeak": "t_j5va_pwWeak",
|
|
71
|
-
"sortButton": "t_j5va_sortButton",
|
|
72
|
-
"empty": "t_j5va_empty",
|
|
73
|
-
"identity": "t_j5va_identity",
|
|
74
|
-
"emptyHint": "t_j5va_emptyHint",
|
|
75
|
-
"field": "t_j5va_field",
|
|
76
|
-
"error": "t_j5va_error",
|
|
77
|
-
"dueBadge": "t_j5va_dueBadge",
|
|
78
|
-
"reportLine": "t_j5va_reportLine",
|
|
79
|
-
"uriCode": "t_j5va_uriCode",
|
|
80
|
-
"revealButton": "t_j5va_revealButton",
|
|
81
|
-
"editorActions": "t_j5va_editorActions",
|
|
82
|
-
"badgeDanger": "t_j5va_badgeDanger",
|
|
83
|
-
"detailBox": "t_j5va_detailBox",
|
|
84
|
-
"lockedTag": "t_j5va_lockedTag",
|
|
85
|
-
"totp": "t_j5va_totp",
|
|
86
|
-
"saveButton": "t_j5va_saveButton",
|
|
87
|
-
"scoreRing": "t_j5va_scoreRing",
|
|
88
96
|
"pwMeter": "t_j5va_pwMeter",
|
|
89
|
-
"secretField": "t_j5va_secretField",
|
|
90
97
|
"policyBar": "t_j5va_policyBar",
|
|
91
|
-
"row": "t_j5va_row",
|
|
92
|
-
"title": "t_j5va_title",
|
|
93
|
-
"highBadge": "t_j5va_highBadge",
|
|
94
98
|
"auditIssues": "t_j5va_auditIssues",
|
|
95
|
-
"
|
|
96
|
-
"addButton": "t_j5va_addButton",
|
|
97
|
-
"policyField": "t_j5va_policyField",
|
|
98
|
-
"genHist": "t_j5va_genHist",
|
|
99
|
+
"backupButton": "t_j5va_backupButton",
|
|
99
100
|
"clearButton": "t_j5va_clearButton",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"emptyBox": "t_j5va_emptyBox"
|
|
101
|
+
"tabActive": "t_j5va_tabActive",
|
|
102
|
+
"pwBar": "t_j5va_pwBar"
|
|
103
103
|
};
|
|
104
104
|
//#endregion
|
|
105
105
|
//#region src/client/VaultSection.tsx
|
|
@@ -318,7 +318,9 @@ window.__ModuleLoader__.load({
|
|
|
318
318
|
lowercase: true,
|
|
319
319
|
digits: true,
|
|
320
320
|
symbols: true,
|
|
321
|
-
excludeAmbiguous: false
|
|
321
|
+
excludeAmbiguous: false,
|
|
322
|
+
passphrase: false,
|
|
323
|
+
words: 4
|
|
322
324
|
});
|
|
323
325
|
const [showGenOpts, setShowGenOpts] = (0, react.useState)(false);
|
|
324
326
|
const [pwStrength, setPwStrength] = (0, react.useState)(null);
|
|
@@ -420,12 +422,24 @@ window.__ModuleLoader__.load({
|
|
|
420
422
|
/** Apply a template's field values to the current form. The form is reset
|
|
421
423
|
* to its empty state first (so fields the template does not set are cleared
|
|
422
424
|
* rather than leaking the previous template's values), then the template's
|
|
423
|
-
* fields are applied. Secret-ish fields are never filled from a template.
|
|
425
|
+
* fields are applied. Secret-ish fields are never filled from a template.
|
|
426
|
+
* Non-catalog kinds (wifi/server/database/identity/bank templates) map to
|
|
427
|
+
* the closest catalog kind so the kind selector and store stay consistent. */
|
|
428
|
+
const CATALOG_KIND = {
|
|
429
|
+
wifi: "login",
|
|
430
|
+
server: "ssh",
|
|
431
|
+
database: "ssh",
|
|
432
|
+
identity: "login",
|
|
433
|
+
bank: "card"
|
|
434
|
+
};
|
|
424
435
|
function applyTemplate(name) {
|
|
425
436
|
const tpl = tplList.find((t) => t.name === name);
|
|
426
437
|
if (!tpl) return;
|
|
427
438
|
const next = {};
|
|
428
|
-
if (tpl.kind !== "builtin:custom")
|
|
439
|
+
if (tpl.kind !== "builtin:custom") {
|
|
440
|
+
const raw = tpl.kind.replace("builtin:", "");
|
|
441
|
+
next.kind = CATALOG_KIND[raw] ?? raw;
|
|
442
|
+
}
|
|
429
443
|
for (const [key, value] of Object.entries(tpl.fields)) {
|
|
430
444
|
if (key === "password" || key === "otpSecret" || key === "apiKey" || key === "secret") continue;
|
|
431
445
|
next[key] = value;
|
|
@@ -3400,6 +3414,29 @@ window.__ModuleLoader__.load({
|
|
|
3400
3414
|
className: VaultSection_module_css_default.genOpts,
|
|
3401
3415
|
children: [
|
|
3402
3416
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3417
|
+
className: VaultSection_module_css_default.genOptRow,
|
|
3418
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("genPassphrase") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3419
|
+
type: "checkbox",
|
|
3420
|
+
checked: genOpts.passphrase,
|
|
3421
|
+
onChange: (event) => setGenOpts((previous) => ({
|
|
3422
|
+
...previous,
|
|
3423
|
+
passphrase: event.target.checked
|
|
3424
|
+
}))
|
|
3425
|
+
})]
|
|
3426
|
+
}),
|
|
3427
|
+
genOpts.passphrase ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3428
|
+
className: VaultSection_module_css_default.genOptRow,
|
|
3429
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("genWords") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3430
|
+
type: "number",
|
|
3431
|
+
min: 2,
|
|
3432
|
+
max: 12,
|
|
3433
|
+
value: genOpts.words,
|
|
3434
|
+
onChange: (event) => setGenOpts((previous) => ({
|
|
3435
|
+
...previous,
|
|
3436
|
+
words: Math.max(2, Math.min(12, Number(event.target.value) || 4))
|
|
3437
|
+
}))
|
|
3438
|
+
})]
|
|
3439
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3403
3440
|
className: VaultSection_module_css_default.genOptRow,
|
|
3404
3441
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("genLength") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3405
3442
|
type: "number",
|
|
@@ -3411,21 +3448,7 @@ window.__ModuleLoader__.load({
|
|
|
3411
3448
|
length: Math.max(6, Math.min(64, Number(event.target.value) || 24))
|
|
3412
3449
|
}))
|
|
3413
3450
|
})]
|
|
3414
|
-
}),
|
|
3415
|
-
genHistory.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3416
|
-
className: VaultSection_module_css_default.genHist,
|
|
3417
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [t("genHistory"), ":"] }), genHistory.slice(0, 3).map((h, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3418
|
-
type: "button",
|
|
3419
|
-
className: VaultSection_module_css_default.revealButton,
|
|
3420
|
-
onClick: () => setForm((previous) => ({
|
|
3421
|
-
...previous,
|
|
3422
|
-
password: h.password
|
|
3423
|
-
})),
|
|
3424
|
-
title: new Date(h.at).toLocaleString(),
|
|
3425
|
-
children: h.password
|
|
3426
|
-
}, i))]
|
|
3427
|
-
}),
|
|
3428
|
-
[
|
|
3451
|
+
}), [
|
|
3429
3452
|
"uppercase",
|
|
3430
3453
|
"lowercase",
|
|
3431
3454
|
"digits",
|
|
@@ -3441,7 +3464,20 @@ window.__ModuleLoader__.load({
|
|
|
3441
3464
|
[key]: event.target.checked
|
|
3442
3465
|
}))
|
|
3443
3466
|
})]
|
|
3444
|
-
}, key))
|
|
3467
|
+
}, key))] }),
|
|
3468
|
+
genHistory.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3469
|
+
className: VaultSection_module_css_default.genHist,
|
|
3470
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [t("genHistory"), ":"] }), genHistory.slice(0, 3).map((h, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3471
|
+
type: "button",
|
|
3472
|
+
className: VaultSection_module_css_default.revealButton,
|
|
3473
|
+
onClick: () => setForm((previous) => ({
|
|
3474
|
+
...previous,
|
|
3475
|
+
password: h.password
|
|
3476
|
+
})),
|
|
3477
|
+
title: new Date(h.at).toLocaleString(),
|
|
3478
|
+
children: h.password
|
|
3479
|
+
}, i))]
|
|
3480
|
+
})
|
|
3445
3481
|
]
|
|
3446
3482
|
}),
|
|
3447
3483
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
@@ -3797,6 +3833,8 @@ window.__ModuleLoader__.load({
|
|
|
3797
3833
|
autoLockNeverHint: "auto-lock off",
|
|
3798
3834
|
purge: "Delete permanently",
|
|
3799
3835
|
purgeOneConfirm: "Permanently delete \"{name}\"? This cannot be undone.",
|
|
3836
|
+
genPassphrase: "Memorable passphrase",
|
|
3837
|
+
genWords: "Words (2–12)",
|
|
3800
3838
|
kindLogin: "Login",
|
|
3801
3839
|
kindSsh: "SSH",
|
|
3802
3840
|
kindApiKey: "API key",
|
|
@@ -4111,6 +4149,8 @@ window.__ModuleLoader__.load({
|
|
|
4111
4149
|
autoLockNeverHint: "自动锁定已关闭",
|
|
4112
4150
|
purge: "永久删除",
|
|
4113
4151
|
purgeOneConfirm: "永久删除「{name}」?此操作不可撤销。",
|
|
4152
|
+
genPassphrase: "易记短语密码",
|
|
4153
|
+
genWords: "单词数(2–12)",
|
|
4114
4154
|
kindLogin: "登录",
|
|
4115
4155
|
kindSsh: "SSH",
|
|
4116
4156
|
kindApiKey: "API 密钥",
|