How your journal is encrypted
Your entries are encrypted in your browser, with a key only you can unlock, before they are saved. This page explains exactly how: the algorithms, the keys, what is encrypted and what isn't, what we can and can't see, and the limits. Trust is the whole point of this journal, so we would rather tell you the limits than overpromise.
In short
- The title and text of every entry, and the photos you upload, are encrypted on your device with AES-256-GCM before they reach us.
- The key that encrypts them is unlocked by your passphrase or your recovery key. Neither is ever sent to us.
- We can't read your entries, and we can't recover them if you lose both your passphrase and your recovery key.
- We can still see metadata: your email address, the dates of your entries, how many there are and roughly how long each one is.
- Encryption in a web app depends on the code your browser runs. If that code were ever compromised, it could read your entries once you unlock them. See What this doesn't protect against, below.
What is encrypted, and what isn't
| Encrypted with your key | Visible to us and to our database host (Google Firebase) |
|---|---|
| The title of each entry | Your email address, and your name if you added one |
| The text of each entry, with its formatting and image links | How you sign in, and when you accepted the terms |
| Drafts you haven't saved, kept only on your device | The date of each entry, and when it was last changed |
| The search index, kept only on your device | How many entries you have |
| The photos you upload, and their small copies | How many photos you have, and when each was uploaded or deleted |
| The size of each photo, rounded up to the next 64 KB | |
| How much of your storage is used | |
| The size of each entry, rounded up to the next kilobyte | |
| When entries were deleted (their ids, not their content) | |
| When you use the journal, and the network address you connect from | |
| Your wrapped keys, with their salt and Argon2id settings |
A photo you upload is made smaller on your device first. A photo's file also hides details you don't see when you look at it: where it was taken (often to within a few metres), when, and with which phone or camera. These are removed on your device as the photo is made smaller, so they never reach us, not even encrypted. The photo is then encrypted with a key of its own, derived from your master key, and stored in Google Cloud Storage: your entry only holds its random id. Photos you have looked at are kept on your device, still encrypted.
Pictures can also be added by their web address. Your entry stores the address encrypted, but the site that hosts the picture sees your network address when your browser loads it.
The building blocks
We use standard, well-reviewed algorithms only. Nothing here is custom cryptography.
| Purpose | Algorithm |
|---|---|
| Encrypting entries and keys | AES-256-GCM, with a fresh random 96-bit IV for every encryption, from your browser's built-in Web Crypto |
| Turning your passphrase into a key | Argon2id: 64 MiB of memory, 3 iterations, parallelism 1, random 128-bit salt, run by hash-wasm in a Web Worker |
| Deriving one key per purpose | HKDF-SHA-256, from Web Crypto |
| Randomness | crypto.getRandomValues, from Web Crypto |
AES-GCM is authenticated encryption: any change to the encrypted data, or the wrong key, makes decryption fail instead of returning garbage. That is also how the app knows a passphrase is wrong.
Argon2id is deliberately slow and memory-hungry. Unlocking once costs you a moment; someone who copied our database and tries to guess your passphrase pays that cost for every single guess. The salt makes the same passphrase give a different key for every account.
The keys
In one line: your passphrase (through Argon2id) or your recovery key unlocks the master key, and the master key gives the entry key (through HKDF), which encrypts your entries.
- The master key is 256 random bits, created in your browser when you set up encryption. It is never stored or sent anywhere unencrypted.
- It is stored in our database twice, encrypted ("wrapped"): once with a key derived from your passphrase, once with your recovery key. Either one unlocks it.
- The recovery key is another 256 random bits, shown to you once as 55 characters (with a short checksum to catch typos). It is strong enough to be used as a key directly.
- The entry key is derived from the master key with HKDF, and used only for entries, drafts and the search index. A future kind of data (such as files) will get its own key.
- Changing your passphrase only re-wraps the master key. Your entries are not re-encrypted.
Each wrapped key is bound to your account and to its slot (passphrase or recovery), and each encrypted entry is bound to your account and to that entry. Someone with access to the database can't move an encrypted entry into another entry or another account: decryption would fail.
Before encrypting, each saved entry is padded to a multiple of 1 KiB, so its exact length doesn't show, only its size class.
Your passphrase and your login
The encryption passphrase is separate from how you log in (password, Google or an email link).
- Resetting your login password never touches your entries, and never gives access to them.
- Your passphrase must be at least 12 characters. A few random words work well.
- Your passphrase is only used in your browser, and is never sent to us. A wrong passphrase is detected there too.
Unlocking, and "Remember this device"
When you unlock your journal, your browser reads the wrapped master key, derives the passphrase key with Argon2id and unwraps the master key. The master key then lives in the page's memory, in a form JavaScript can use but can't read back: it can only derive other keys, which come out in the same unreadable form.
If you tick Remember this device, the master key is kept in this browser's storage (IndexedDB) in the same form, so the journal opens without your passphrase until you log out. Logging out, by any route, deletes it. Anyone who can use that browser while you are logged in can read your journal, so don't use it on a shared computer.
If you lose your passphrase or your recovery key
- Lost your passphrase: your recovery key unlocks the master key, and you choose a new passphrase.
- Lost your recovery key: create a new one in your Profile. The old one stops working.
- Lost both: your entries can't be decrypted, by you, by us, or by anyone. There is no back door and no assisted recovery. The app can delete the unreadable entries and set up encryption again; this asks you to sign in again first, so someone at an unlocked computer can't wipe your journal in one click.
When you change your passphrase or recovery key, the old copy of the wrapped key is deleted (if that fails, the app tries again, or asks you to from your Profile). Two limits apply. Our database backups keep deleted data for a while (daily backups for 30 days), so for that long an old passphrase still opens an old backup copy. And the master key itself never changes: someone who copied your data earlier and knows an old passphrase or recovery key could still read the entries in that copy. Changing the master key ("key rotation") isn't supported yet.
What we can and can't see
We can't see: the title or text of any entry, your drafts, your search index, your passphrase, your recovery key or your master key.
We can see: the metadata listed in the table above, and the encrypted data itself. Our database rules reject entries that aren't in the encrypted format, but they can't check that the encrypted bytes really are encrypted. That guarantee comes from the app's code and its tests.
If we were asked for your data, by a court or anyone else, we could only hand over what we hold: the encrypted entries, the wrapped keys and the metadata.
What this protects against
- Anyone who reads our database: us, Google as our host, someone with a leaked admin credential, or a misconfigured database rule.
- Leaked database backups.
- A legal request for the database: it holds no readable entries.
What this doesn't protect against
- A compromised version of the app. Your browser runs the code our website serves each time you open it. If that code were ever tampered with (through our accounts, our build pipeline, our hosting provider or one of the libraries we use), it could read your entries after you unlock them. This is the main limit of encryption in any web app. To reduce the risk, our dependencies are pinned with a lockfile, and the site sends a Content Security Policy that only lets the page run scripts from our own site (and Google's, for Google sign-in).
- Malicious scripts in the page (cross-site scripting). A script injected into the page could read decrypted entries. Every entry's text is cleaned of scripts, event handlers and anything that fetches another site, both when it is saved and when it is shown, and the Content Security Policy blocks inline scripts and scripts from other sites should anything slip through.
- A compromised device, a malicious browser extension, or someone using your unlocked journal.
- A weak passphrase. Argon2id makes guessing slow, but not impossible for a short or common passphrase. Pick a long one.
- Metadata (see the table above).
- Error reports. We use Sentry to learn about crashes. It runs in the page, where your entries are decrypted. Encryption errors are reported with a fixed message, without their original text, and what you type or click is not recorded, but a report about an unrelated error could in rare cases include text from the page.
- Exports. "Export my data" decrypts your entries in your browser and downloads them as a readable file. Keep it somewhere safe.
Deleting your account
Deleting your account deletes your entries and your wrapped keys from our database. Backups keep the encrypted entries and wrapped keys until they expire, up to 30 days.
Questions, or found a problem?
If you think something here is wrong, or you have found a security issue, email contact@my-personal-journal.com. We'll reply and correct this page when it is.
My Personal Journal · How to · Blog · Security · Legal · Made by PrismaLink