How is my data encrypted?
Everything you write is encrypted on your own device before it is sent anywhere. The Notesnook server stores ciphertext it cannot open, which is why nobody here can read your notes — and why nobody here can recover them for you if you lose both your password and your recovery key.
This is an explanation, not a specification
This page describes how the encryption works in practice. It is not a formal spec.
Algorithms & cryptographic library
| Purpose | Algorithm |
|---|---|
| Encrypting and decrypting your data | XChaCha20-Poly1305-IETF |
| Deriving your master key from your password | Argon2i |
| Hashing your password for the server | Argon2id |
All of it comes from libsodium. Web, desktop and mobile use the same library for every cryptographic operation, so a note encrypted on one platform decrypts identically on the others.
Process
1. Sign up & sign in
When you sign up for an account, the app takes your password and hashes it using Argon2 with a predictable per user salt.
This predictable salt is generated using a fixed client salt + your email.
Your password never leaves your device
Only the hash is sent, never the password itself, so there is no way for us — or anyone who intercepts the request — to learn your password.
After the hash is generated, it is sent to the server. This hash is used as a password and is hashed again to mitigate password passthrough attacks.
This process is repeated every time you sign in.
2. Key generation
When you first sign up for an account, your client generates two encryption keys. One is a unique data encryption key that encrypts all your notes and other data. The second is your master encryption key, derived from your password and that predictable salt. This key protects all your encryption keys, like the aforementioned data encryption key. If you change your password, your client will re-encrypt your existing data encryption key with your new master key.
3. Encryption key storage
Instead of storing the key as plain text (and allowing anyone to copy/move it), we use browser's IndexedDB to store the key as a CryptoKey.
CryptoKey is stored securely by the browser and cannot be exported, viewed, or copied except by the app & browser.
4. Data encryption
Encryption takes place when you sync. Each item in the database is encrypted separately using XChaCha20-Poly1305-IETF.
How it works
- The item is read from the database as JSON object and stringified (i.e. converted to a string).
- The string is encrypted using the data encryption key generated earlier.
- The result is a JSON object which contains:
- A base64 encoded
cipher - A 192-bit nonce (
iv) - A random
salt - Algorithm id
alg - ItemId
id
- A base64 encoded
INFO
See the whole process in action here.
This object is then sent to the server for storage. The server performs no further operation on this data (because it can't).
FAQs
Can Notesnook read my notes?
No. Your notes are encrypted on your device with keys that never leave it, and the server only ever receives ciphertext. This is also why we cannot reset your password or recover your notes for you — see recovering your account.
What happens if I forget my password?
Your account recovery key is the only way back into your data. Without your password and without that key, your notes cannot be decrypted by anyone.
I am an old user of Notesnook and I don't have a data encryption key
Your data encryption key is created the next time you change your password.
Related pages
- Private vault — locking individual notes
- Recovering your account — when you forget your password
- Backup and restore — keeping your own encrypted copy
- Two-factor authentication — a second step at login
