NoteOS 1.2.0 is available

Docs / Security

How encryption works

A technical description of NoteOS's end-to-end encryption, key handling and what the server can see.

NoteOS is designed so that the server cannot read your notes, even if it is compromised or its operator is malicious. This page explains how.

Summary

Note encryption AES-256-GCM, a fresh random 96-bit nonce per save
Key derivation scrypt (N = 32768, r = 8, p = 1) → 512 bits
What the server stores Email, a hash of your auth key, your KDF salt, your wrapped note key, note ciphertext
What the server never sees Your password, your note key, note titles, text, colors, or pin/hidden flags

Keys

When you create an account, your device:

  1. Generates a random 128-bit salt.
  2. Runs scrypt over your password and salt to produce 64 bytes, and splits them:
    • auth key (32 bytes) — sent to the server to prove you know the password;
    • key-encryption key, KEK (32 bytes) — never leaves the device.
  3. Generates a random 256-bit note key.
  4. Encrypts (“wraps”) the note key with the KEK using AES-256-GCM.
  5. Sends the email, auth key, salt, KDF parameters and wrapped note key to the server.
password ──scrypt(salt)──► 64 bytes ─┬─ auth key  → server (login only)
                                     └─ KEK       → stays on device
note key (random) ──AES-GCM(KEK)──► wrapped key → server
note JSON ──AES-GCM(note key, AAD = note id)──► ciphertext → server

The server stores the auth key only as a salted scrypt hash, so a database leak can’t be used to log in.

Signing in on a new device

  1. The device asks the server for your salt and KDF parameters. (For unknown emails, the server returns a deterministic fake salt, so this can’t be used to discover who has an account.)
  2. It derives the auth key and KEK from your password.
  3. It logs in with the auth key and receives your wrapped note key.
  4. It unwraps the note key with the KEK. Now it can decrypt your notes.

Notes

Each note is serialized to JSON — title, body, color, pinned, hidden, order, folder, and when it was moved to Trash — and encrypted with the note key using AES-256-GCM. The note’s ID is bound in as additional authenticated data, so the server can’t swap the ciphertext of one note into another. Any tampering makes decryption fail.

The server sees only: note ID, a version number, timestamps, and whether the note is deleted for good. A note in Trash looks like any other note to the server.

Folders are encrypted the same way (name, color, icon and order) with the folder’s ID bound in as folder:<id>, so a folder’s ciphertext can’t be passed off as a note. Which folder a note is in is stored inside the note’s own ciphertext.

Linking a device

A new device can get the note key from one that’s already unlocked, by QR code, without your password:

new device: temporary X25519 key pair → public key + session ID in the QR code
phone:      scans it, makes its own temporary key pair
            shared secret = X25519 → HKDF-SHA256 (salt = session ID) → AES-256-GCM key
            note key ──AES-GCM──► payload → server → new device
  • The public key travels only through the camera; the server never receives it, so it can’t substitute its own.
  • Both screens show a 6-digit check number derived from the QR contents, so you can confirm the phone scanned the right screen.
  • Sessions belong to one account, expire after 2 minutes and are deleted after the payload is collected once. The server stores the new device’s name (such as Chrome on Windows) during that time, so your phone can show it.

Changing your password

Only the wrapped note key changes: your device unwraps it with the old KEK and re-wraps it with the new one. Notes don’t need to be re-encrypted.

Recovery key

When you create an account, your device also makes a random 160-bit recovery key and shows it to you once, as 32 characters. A key derived from it with HKDF-SHA256 wraps the same note key a second time, and only that wrapped copy goes to the server:

recovery key ──HKDF-SHA256──► recovery KEK
note key ──AES-GCM(recovery KEK)──► recovery-wrapped key → server

Forgot password

The server can’t decrypt anything, so a reset only proves you control your email address. The server emails a one-time 6-digit code (stored as an HMAC, valid for 15 minutes, five attempts). After the code is accepted:

  • With the recovery key, your device downloads the recovery-wrapped key, unwraps the note key locally and re-wraps it with your new password. The server never sees the recovery key or the note key.
  • Start fresh: your device makes a new note key and a new recovery key. The old ciphertext is useless without the old key, so the server deletes it.

Every session is revoked either way. Each device remembers a short fingerprint of the note key its notes were synced with. If that key has changed the next time you sign in, the device doesn’t apply the deletions: it uploads its own copies again, encrypted with the new key.

Someone who takes over your email can reset your password, but without your recovery key they only get an empty account. Your old notes stay unreadable to them.

On your device

Notes are also encrypted at rest on your device with a random per-device vault key, which is stored in the operating system’s secure storage (iOS Keychain, Android Keystore, Windows DPAPI, macOS Keychain, Linux libsecret).

Sessions

The server issues short-lived access tokens (15 minutes) and rotating refresh tokens (30 days). If a refresh token that was already used is presented again, the server assumes it was stolen and signs out every session of that account.

Limitations — honestly

  • We can’t unlock your notes for you. If you forget your password and lose your recovery key, synced notes can’t be decrypted. Only the copies still on your devices survive a reset.
  • Your email protects your account. Control of your email lets someone reset your password (but not read your notes). Use a strong email password and two-factor authentication.
  • Metadata: the server knows your email, how many notes you have, their sizes, and when they change.
  • A compromised device is out of scope. Malware on your phone or computer can read what you can read.
  • The web app is delivered by the server each time you open it. A malicious server could in principle serve modified code. If that’s in your threat model, use the mobile or desktop apps.
  • NoteOS has not had an independent security audit yet.

Found a problem? See Security for how to report it.