Files
relicario/extension/setup.html
adlee-was-taken f3b915a635 feat(ext/setup): zxcvbn strength meter + score>=3 gate (audit H3)
Replaces the ad-hoc char-class passphraseStrength() with a 5-segment
bar backed by a SW round-trip to rate_passphrase (zxcvbn). Input
handler debounces 150ms so we don't hammer the worker per keystroke.

The create-vault button is disabled unless the last score is ≥ 3
(zxcvbn's "safely unguessable" threshold), and the handler re-rates
synchronously on click as defence-in-depth. Label flips between "Too
weak" (red) and "Strong enough" (green).

Also:
- rewrites the vault-creation path to use the typed-item unlock +
  manifest_encrypt APIs (derive_master_key/encrypt_manifest are gone);
  the new initial manifest is { schema_version: 2, items: {} }.
- wasm.d.ts is now a pure `declare module 'relicario-wasm'` block;
  tsconfig's stale `paths` alias is removed.
- @ts-nocheck removed from setup.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 21:38:50 -04:00

129 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>relicario — vault setup</title>
<link rel="stylesheet" href="styles.css">
<style>
body {
width: auto;
max-width: 560px;
margin: 40px auto;
padding: 0 20px;
max-height: none;
overflow-y: auto;
}
.step-instructions {
background: #161b22;
border: 1px solid #30363d;
border-radius: 6px;
padding: 16px;
margin: 12px 0;
font-size: 12px;
line-height: 1.7;
}
.step-instructions ol {
padding-left: 20px;
}
.step-instructions li {
margin-bottom: 4px;
}
.step-instructions code {
background: #21262d;
padding: 1px 5px;
border-radius: 3px;
font-size: 12px;
}
.image-preview {
max-width: 200px;
max-height: 150px;
border-radius: 4px;
border: 1px solid #30363d;
margin-top: 8px;
}
.strength-bar {
display: flex;
gap: 3px;
margin-top: 6px;
}
.strength-bar .seg {
flex: 1;
height: 4px;
background: #21262d;
border-radius: 2px;
transition: background 0.2s;
}
/* zxcvbn score-driven colors. Higher-scored bars light up earlier bars too. */
.strength-bar.s0 .seg.i0 { background: #f85149; }
.strength-bar.s1 .seg.i0,
.strength-bar.s1 .seg.i1 { background: #db6d28; }
.strength-bar.s2 .seg.i0,
.strength-bar.s2 .seg.i1,
.strength-bar.s2 .seg.i2 { background: #d29922; }
.strength-bar.s3 .seg.i0,
.strength-bar.s3 .seg.i1,
.strength-bar.s3 .seg.i2,
.strength-bar.s3 .seg.i3 { background: #3fb950; }
.strength-bar.s4 .seg { background: #3fb950; }
.strength-label {
font-size: 11px;
margin-top: 3px;
}
.strength-label.weak { color: #f85149; }
.strength-label.strong { color: #3fb950; }
.success-box {
background: #0d1b0e;
border: 1px solid #238636;
border-radius: 6px;
padding: 20px;
margin: 16px 0;
text-align: center;
}
.success-box h3 {
color: #3fb950;
margin-bottom: 8px;
}
.config-blob {
background: #161b22;
border: 1px solid #30363d;
border-radius: 4px;
padding: 12px;
font-size: 11px;
word-break: break-all;
user-select: all;
margin: 12px 0;
max-height: 120px;
overflow-y: auto;
}
.test-result {
display: inline-flex;
align-items: center;
gap: 6px;
margin-top: 8px;
font-size: 12px;
}
.test-result.pass { color: #3fb950; }
.test-result.fail { color: #f85149; }
</style>
</head>
<body>
<div id="app"></div>
<script src="setup.js"></script>
</body>
</html>