feat: an "Allow weak passwords" setting lets a new wallet have a short password (closes #674)
Settings has a new "Allow weak passwords" checkbox, off in a new profile. While it is off, AddWallet refuses a password shorter than 12 characters, as before. While it is on, AddWallet accepts any password that is not empty. Key derivation is unchanged: one Argon2id derivation at libsodium's interactive setting. README's Key Decisions now states those parameters and why one light derivation is enough: the password's length is what protects the stored secret. The screens say "password", as README's wording rules require, so the setting is "Allow weak passwords". Model: opus-5-5
This commit was merged in pull request #677.
This commit is contained in:
@@ -980,6 +980,23 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="bg-well p-3 mx-1 mb-3">
|
||||
<h3 class="font-bold mb-1">Passwords</h3>
|
||||
<label
|
||||
class="text-xs flex items-center gap-1 cursor-pointer mb-1"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="settings-allow-weak-passwords"
|
||||
/>
|
||||
Allow weak passwords
|
||||
</label>
|
||||
<p class="text-xs text-muted">
|
||||
Lets you choose a password shorter than 12 characters
|
||||
when you add a wallet.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-well p-3 mx-1 mb-3">
|
||||
<h3 class="font-bold mb-1">Tracked Tokens</h3>
|
||||
<p class="text-xs text-muted mb-2">
|
||||
|
||||
@@ -132,7 +132,8 @@ function validatePassword() {
|
||||
showError("add-wallet-password-error", "Please choose a password.");
|
||||
return null;
|
||||
}
|
||||
if (pw.length < 12) {
|
||||
// "Allow weak passwords" in Settings lifts the 12-character minimum.
|
||||
if (!state.allowWeakPasswords && pw.length < 12) {
|
||||
showError(
|
||||
"add-wallet-password-error",
|
||||
"Password must be at least 12 characters.",
|
||||
|
||||
@@ -499,6 +499,12 @@ function init(_ctx) {
|
||||
await saveState();
|
||||
});
|
||||
|
||||
$("settings-allow-weak-passwords").checked = state.allowWeakPasswords;
|
||||
$("settings-allow-weak-passwords").addEventListener("change", async () => {
|
||||
state.allowWeakPasswords = $("settings-allow-weak-passwords").checked;
|
||||
await saveState();
|
||||
});
|
||||
|
||||
$("btn-main-add-wallet").addEventListener("click", ctx.showAddWalletView);
|
||||
|
||||
$("btn-settings-add-token").addEventListener(
|
||||
|
||||
@@ -56,6 +56,9 @@ const DEFAULT_STATE = {
|
||||
// else.
|
||||
useBlockscout: false,
|
||||
checkRecipientsOnEtherscan: false,
|
||||
// "Allow weak passwords" in Settings. While it is off, AddWallet refuses a
|
||||
// password shorter than 12 characters.
|
||||
allowWeakPasswords: false,
|
||||
fraudContracts: [],
|
||||
tokenHolderCache: {},
|
||||
theme: "system",
|
||||
@@ -418,6 +421,9 @@ function normalizePersisted(saved) {
|
||||
// service.
|
||||
out.useBlockscout = saved.useBlockscout === true;
|
||||
out.checkRecipientsOnEtherscan = saved.checkRecipientsOnEtherscan === true;
|
||||
// Anything but true is off: the setting lets AddWallet accept a short
|
||||
// password.
|
||||
out.allowWeakPasswords = saved.allowWeakPasswords === true;
|
||||
// A list of contract addresses, floored the same way: send.js builds its
|
||||
// fraud set as `(state.fraudContracts || []).map((a) => a.toLowerCase())`
|
||||
// and filterTransactions() maps the same list through normalizeAddress(),
|
||||
|
||||
Reference in New Issue
Block a user