feat(ui): 安全增强 — 修改密码 / 自动锁定 / HOTP 提示 / 配置备份

- 修改密码对话框引入旧密码校验:通过 store.VerifyPassword 走 constant-time
  比较,对话框自身不持有 live passphrase 副本。
- 配置加密且 auto_lock_minutes>0 时启用自动锁定;明文配置不受影响。
  锁定时刻意保留 store.passphrase,避免解锁瞬间出现保存竞态——进程内存
  无论如何都是威胁边界。
- HOTP 点击后 toast 仅显示推进后的计数器值,绝不携带验证码字符串。
- SaveYAML 每次写入前将旧文件轮转为 .bak(0o600),防止加密/序列化失败
  导致用户无可恢复副本。
- Preferences 对话框新增"自动锁定(分钟)"输入项。
This commit is contained in:
2026-06-12 03:56:41 +08:00
parent fedc198452
commit 0918fd446a
9 changed files with 367 additions and 17 deletions
+29
View File
@@ -419,3 +419,32 @@ other = "MIT"
[about_credits]
other = "原版 WinAuth 由 Colin Mackie 创作。Go 移植由本项目作者维护。"
# --- 安全:修改密码 / 自动锁定 / HOTP 提示 ---
[menu_change_password]
other = "修改密码..."
[dialog_change_password_title]
other = "修改密码"
[label_password_current]
other = "当前密码"
[label_password_new]
other = "新密码"
[msg_password_changed]
other = "密码已更新。"
[msg_hotp_advanced]
other = "计数器推进到 %d"
[msg_locked]
other = "因长时间无操作已锁定,请输入密码解锁。"
[label_auto_lock_minutes]
other = "自动锁定(分钟)"
[hint_auto_lock_disabled]
other = "填 0 关闭。仅当配置已加密时生效。"