wikly.app

Two locks, and only one of them is security

Setting a password on the desk turns on two switches, and the card that offers them is careful to keep them apart, because only one of them is security and the difference is the kind of thing people get hurt by.

The gate

The first switch asks for the password when the desk opens. It is a curtain. It stops the colleague who walks past your unattended screen, and that is a real thing worth stopping — most of the privacy anyone actually needs at a desk is privacy from people in the room.

It stops nobody who opens the browser's own developer tools. With the gate alone, your tasks are sitting in localStorage in plain text, where anything running on the page can read them and where a person who knows to look can read them in about four seconds. That is not a flaw in the implementation. It is what a lock screen is, in a browser, and an app that let you believe otherwise would be doing something worse than not offering it.

The gate does one thing properly, though. A locked desk is not rendered at all — not hidden behind an overlay, not blurred, not built and then covered. The writing is not in the page. A screen you can read through the lock is not locked.

The seal

The second switch is the real one. Turn it on and your tasks are encrypted with AES-256 in GCM mode, and what sits on the disk is bytes that nobody can read without the password — including whoever wrote the app.

The key comes from your password by PBKDF2 with SHA-256, stretched over six hundred thousand rounds. That count is deliberately expensive: it makes a guess cost the guesser the same time it costs you, which is the entire defence against somebody with a copy of the file and a list of common passwords. Each desk gets its own random salt, so two people who pick the same password do not end up with the same key. Every write gets a fresh nonce, because reusing one with the same key is how AES-GCM stops protecting anything at all.

The round count is written into the lock rather than fixed in the code, and that is not fussiness. The key is the count. If the number were raised in a future version, every desk locked under the old one would derive a different key and every password in the world would stop working. So new desks get the current figure and old desks keep theirs, for as long as they live.

Your password itself is never stored anywhere. What is stored is a short known word, sealed with the key. If it unseals, the password was right. There is nothing on the disk to compare a guess against.

What is sealed and what is not

One key is encrypted: the one that holds your writing. Your tasks and the notes inside them. Everything else — the lamp colour, the radio station, the sort order, which hints you have dismissed — stays in the clear, because it is settings and taste and encrypting it would buy nothing and cost the ability to open the desk and have it look right.

Turning the seal on also turns the gate on and then holds that switch where it is, which is not an oversight. Sealed writing cannot be read without the password anyway; a desk that opened without asking would only be showing you an empty room and then asking.

Which one you want

If the threat is people walking past, the gate is enough and it is free. If the threat is anything that involves somebody having access to the machine or the disk — a shared computer, a laptop that travels, a backup file you keep on a drive — then it is the seal or it is nothing, and the seal comes with a cost that gets its own post: there is no server, so there is no reset.