Skip to content

Change your password in Settings - #34

Merged
aakashns merged 1 commit into
mainfrom
change-password
Oct 19, 2026
Merged

aakashns merged 1 commit into
mainfrom
change-password

Conversation

@aakashns

@aakashns aakashns commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Settings has a new last row, Change password. Enter or a click opens a dialog with three boxed password fields: current password, new password, confirm new password.

  • Tab (or ↑/↓) moves between the fields. Enter goes on to the next empty field, then changes the password. Esc or Cancel closes the dialog. The fields and both buttons can be clicked.
  • A wrong current password, a confirmation that doesn't match, or a new password under 8 characters (the same rule as setup) is shown in red in the dialog, and the dialog stays open.
  • While the change runs, the dialog shows "Changing the password…". Then Settings shows "Password changed."

The dialog
A confirmation that doesn't match
Changing
Changed
The whole flow

What happens to the vault

  1. It checks that the current password gives the open vault's key.
  2. It makes a new random salt and the new Argon2 key, and backs the vault up next to itself (writui.db.password-<time>.bak).
  3. SQLCipher's rekey re-encrypts every page in one transaction and writes the new salt into the file.
  4. The vault is then reopened from scratch, exactly as an unlock would: the salt is read from the file and the key comes from the new password. It must pass both integrity checks and hold exactly the same data as before (a SHA-256 over every row of every table). Only after that is the backup deleted.
  5. If anything fails after the backup is made, the vault is reopened with the old password. If that doesn't work, it's copied back from the backup and checked the same way. Settings then says why the change failed and that the old password still works. Only if even that fails does writui stop, with an error saying where the backup is.

Touch ID: if it's on, its key file is made again for the new key (that doesn't need a fingerprint). If that fails, Touch ID is turned off and Settings says so.

Checked

  • 170 tests pass; clippy and fmt are clean. New tests: a successful change (old password refused, new one works, everything kept, backup gone), a wrong current password (file byte-for-byte unchanged), and three ways for the change to fail after the rekey: a failing check, a damaged vault, and a damaged vault and backup. The first two leave the old password working with nothing lost; the last keeps the backup and names it.
  • Against a vault made by the 0.19.0 release binary (two posts, a saved version, author and styling settings, Touch ID on): this build changed its password. Afterwards the file has a new salt and no backup is left. The 0.19.0 binary then refuses the old password and opens the vault with the new one: both posts, the "First draft" version and the settings are all there.
  • Touch ID: with it on, changing the password rewrote its key file and kept Touch ID on. Not tested: actually unlocking with a fingerprint after a change, since that needs your finger. Please try it (below).

Try it

gh pr checkout 34 && cargo run

Debug builds use .dev-data/ (password writui-dev), never your real vault. In Settings (s on the list), go to Change password and change writui-dev to anything, then press Ctrl+O and unlock with the new password. Change it back to writui-dev when you're done.

To check Touch ID too: turn it on in Settings, change the password, quit, and start cargo run again. It should ask for your fingerprint and unlock.

Also in this PR: 0.20.0, README (how to change the password), SPEC, DECISIONS and PLAN.

🤖 Generated with Claude Code

Settings has a new last row, "Change password". Enter or a click opens a
dialog with three boxes: your current password, the new one, and the new
one again. Tab moves between them, Enter goes on to the next empty one
and then changes the password, and Esc cancels. A wrong current password,
a confirmation that doesn't match, or a new password under 8 characters
is said in the dialog, which stays open. It says "Changing the password…"
while it works, then Settings says "Password changed."

Your vault is re-encrypted in place with the new password. writui backs
it up first and deletes the backup only once the vault has reopened with
the new password, passed its integrity checks and still holds exactly
what it did. If anything goes wrong, the vault is left (or put back from
the backup) as it was, and the old password keeps working. If Touch ID is
on, it's set up again for the new password on its own; if that can't be
done, Touch ID is turned off and Settings says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 727042d 2026-10-19T08:50:41.070Z Visit the dashboard ↗

@aakashns
aakashns merged commit fbdbd7b into main Oct 19, 2026
3 checks passed
@aakashns
aakashns deleted the change-password branch October 19, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant