Security architecture
This page describes how Notvex protects a vault, for readers who want to judge the design rather than take it on trust. All the code is open source under the AGPL-3.0, and the source files are named so you can check each claim. For practical advice, see Security practices.
Threat model
Section titled “Threat model”Notvex is designed for one situation: someone has a copy of your vault file but not your secrets. That covers a stolen laptop or USB drive, a cloud folder someone else can read, or a backup that ends up in the wrong place. In that case, the file should reveal nothing about your notes, and guessing the password should be slow and expensive.
Notvex doesn’t try to protect a vault that’s unlocked on a compromised computer. Malware running as you can read the screen, the keyboard, and the app’s memory, and no app-level encryption stops that. It also doesn’t hide that a vault exists: the file’s size and modification time are visible like any other file’s.
The vault file
Section titled “The vault file”A vault is a single .nvx file: a small header followed by a complete SQLCipher database.
| Part | Contents |
|---|---|
| Magic and version | NVX\0, then the format’s major and minor version |
| Argon2id salt | Random per vault, regenerated when the master key changes |
| KDF tier | One byte that selects the Argon2id parameters (see the next section) |
| Recovery blob | The master key, encrypted with a key derived from the recovery key |
| Header HMAC | Keyed BLAKE2b over every header byte before it |
| Database | The SQLCipher database, encrypted page by page |
The header HMAC uses a subkey derived from the master key with a fixed context string, so it never reuses the database key directly. Notvex checks it before it touches the database, which detects a modified header, such as a swapped salt or KDF tier.
Key derivation
Section titled “Key derivation”Notvex derives a 256-bit master key from your password with Argon2id (libsodium’s crypto_pwhash).
When you create a vault, Notvex measures this computer’s speed and picks the strongest of ten parameter sets that finishes within about 1.5 seconds. The header stores only the tier number:
| Tiers | Memory | Passes |
|---|---|---|
| 1–2 | 512 MB | 4, 3 |
| 3–4 | 256 MB | 4, 3 |
| 5–6 | 128 MB | 3, 2 |
| 7–8 | 64 MB | 3, 2 |
| 9–10 | 32 MB | 3, 2 |
Every guess costs an attacker the same memory and time, on hardware they control. The parameters are calibrated once, so a vault created on a fast computer stays at its tier when you open it on a slower one.
Key file. If you add a key file, Notvex hashes its first 1 MB with BLAKE2b and appends the hash to the password before Argon2id. Without the exact file, the derived key is different.
Recovery key. The 24 words are a BIP39 mnemonic with 256 bits of entropy. Notvex turns them into a key (the first 32 bytes of the BIP39 seed) and uses it to encrypt the master key with XChaCha20-Poly1305. That’s the recovery blob in the header. With a key file, the wrapping key is BLAKE2b of the recovery key and the key file’s hash, so the recovery key alone can’t unwrap it.
Changing the password or the key file produces a new master key. Notvex re-keys the database, re-encrypts every note, and generates a new recovery key, so old credentials stop working.
Two layers of encryption
Section titled “Two layers of encryption”- SQLCipher encrypts the entire database file with AES-256, page by page. Notvex passes the master key to SQLCipher as a raw key, so SQLCipher doesn’t run its own, weaker key derivation.
- XChaCha20-Poly1305 encrypts each note’s title and content again, individually, with a random nonce per field. Even someone who could read the decrypted database pages would see only ciphertext for those fields.
Both layers use the same master key. Only the header HMAC uses a separate subkey derived from it.
Not everything gets the second layer. This table shows what each layer covers:
| Data | SQLCipher | Field encryption |
|---|---|---|
| Note titles and content | Yes | Yes |
| Tag names and colors | Yes | No |
| Dates, pinned and trashed flags | Yes | No |
Tag names stay in plain text inside the encrypted database so Notvex can search and filter them with SQL without decrypting every note. They’re still protected by SQLCipher, so they’re unreadable in the vault file, but they don’t get the second layer. That’s a deliberate trade-off.
The header HMAC is what rejects a wrong password, but it’s no shortcut for an attacker: its key comes from the Argon2id output, so checking a guess against it still costs a full Argon2id run. The file holds nothing cheaper to test guesses against.
The unlocked vault
Section titled “The unlocked vault”- Key in memory. The master key lives only in the main process, in memory outside the JavaScript heap. Notvex asks the operating system to keep that memory out of swap (
VirtualLockon Windows,mlockon macOS and Linux). This is best effort: if the call fails, the app still works. When the vault locks, Notvex overwrites the key with zeros. One known gap: SQLCipher’s Node.js binding only accepts the key as a text string, and JavaScript can’t wipe strings, so a copy can stay in memory until it’s garbage-collected. - Working copy. While the vault is unlocked, Notvex works on a temporary copy of the database in your system’s temp folder. That copy is still SQLCipher-encrypted. Notvex writes it back into the
.nvxfile every 30 seconds and when you lock, and deletes it afterward. - Unlock attempts. After three failed attempts, each new one has to wait longer: 5, 15, and 30 seconds, then one more minute each time. This slows guessing in the app itself. Against a copied file, Argon2id is what matters.
How it works, step by step
Section titled “How it works, step by step”The sections above describe each part on its own. This one follows a vault through its life: what Notvex does, in order, when you create, unlock, edit, lock, and recover it.
password (+ key file hash) ── Argon2id ──▶ master key ─┬─▶ SQLCipher (database pages) ├─▶ XChaCha20-Poly1305 (note titles and content) └─▶ BLAKE2b subkey ──▶ header HMAC
24 words ── BIP39 ──▶ recovery key (+ key file hash) ──▶ decrypts the recovery blob ──▶ master keyCreate a vault
Section titled “Create a vault”- Notvex picks the Argon2id tier for this computer (Key derivation), generates a random salt, and derives a 32-byte master key from your password.
- It creates an empty SQLCipher database in a temporary file, keyed with the master key, and sets up its tables.
- It generates the 24 words, turns them into the recovery key, and encrypts the master key with it. The result is the recovery blob.
- It writes the
.nvxfile: the header (The vault file), then the database. The data goes to a temporary file that then replaces the target in one step, so a crash never leaves a half-written vault. - It shows you the 24 words, once. Every intermediate copy of a key is overwritten with zeros as soon as it’s no longer needed.
Unlock with your password
Section titled “Unlock with your password”- Notvex reads the header and checks the
.nvx.lockfile. If another Notvex window on this computer has the vault open, it stops here. - It copies the database part of the file to a temporary file.
- It runs Argon2id on your password, plus the key file’s hash if the vault has one, with the salt and tier from the header.
- It checks the header HMAC with the resulting key. A wrong password or key file fails here, before Notvex touches the database.
- It opens the database with the key and reads one row to confirm it.
- It moves the key into protected memory (The unlocked vault) and zeroes every other copy.
Write a note
Section titled “Write a note”- The interface sends the note to the main process (App isolation).
- The main process encrypts the title and the content separately with XChaCha20-Poly1305, with a new random nonce for each field on every save.
- It writes them to the temporary database, which SQLCipher encrypts again, page by page.
- Every 30 seconds, Notvex writes the temporary database back into the
.nvxfile, replacing it in one step as when the vault was created.
Reading a note runs these steps in reverse. Notvex decrypts every note’s title to show the list and search it, but decrypts the content only of the note you open.
Lock the vault
Section titled “Lock the vault”- Notvex writes the temporary database back into the
.nvxfile one last time. - It closes the database and deletes the temporary file.
- It overwrites the master key, and the key file contents if it’s holding them, with zeros, frees that memory, and deletes the
.nvx.lockfile.
If that last write fails, the vault still locks, and Notvex warns you. How the vault locks lists what makes it lock.
Recover with the 24 words
Section titled “Recover with the 24 words”- Notvex checks the words against the BIP39 checksum and turns them into the recovery key. If the vault has a key file, it combines the two with BLAKE2b.
- It decrypts the recovery blob. With the wrong words or the wrong key file, the Poly1305 tag check fails and nothing is decrypted.
- That gives back the master key, and the vault opens. Notvex then asks you for a new password.
Change your credentials
Section titled “Change your credentials”Setting a new password after a recovery, changing your password or key file, and generating a new recovery key all run the same rotation:
- Notvex generates a new salt, keeps the same tier, and derives a new master key.
- It re-keys the SQLCipher database (
PRAGMA rekey) and re-encrypts every note in one transaction. - It generates new 24 words and a new recovery blob, and writes the file, replacing it in one step.
If any step fails, Notvex closes the vault without writing, so the file on disk stays as it was. After a rotation, the old password and the old 24 words no longer work. That includes Generate new recovery key: your password stays the same, but the master key changes and every note is re-encrypted.
App isolation
Section titled “App isolation”Notvex is an Electron app split into three processes, and only one of them handles keys and data.
- Main process: all cryptography, all SQLCipher access, and the file system.
- Preload: exposes a fixed set of functions to the interface through Electron’s
contextBridge, and nothing else. - Renderer (the interface): runs with context isolation, the Chromium sandbox, and no Node.js access. It can’t run cryptography or SQL itself, only ask the main process through those functions.
The interface also has a strict Content Security Policy that allows only the app’s own scripts. Notvex blocks navigation away from the app, denies every permission request, and opens only allowed external links, in your browser. By default, the window is excluded from screenshots and screen sharing.
The packaged app flips these Electron fuses:
| Fuse | Effect |
|---|---|
RunAsNode off | The Notvex binary can’t be used as a plain Node.js runtime |
EnableNodeOptionsEnvironmentVariable off | NODE_OPTIONS can’t inject code at startup |
EnableNodeCliInspectArguments off | --inspect can’t attach a debugger |
EnableEmbeddedAsarIntegrityValidation on | The app’s code archive is checked against its recorded hash |
OnlyLoadAppFromAsar on | The app loads only from that checked archive |
Network access
Section titled “Network access”Notvex makes one kind of network request: on startup, it asks GitHub whether a new release exists. GitHub sees your IP address, operating system, and app version, never anything from your vaults. Since Notvex 0.3.0, you can turn this off in Settings → Updates → Check for updates on startup. There’s no telemetry. Privacy policy
Has Notvex been audited?
Section titled “Has Notvex been audited?”Not yet. No independent security firm has reviewed Notvex. The design uses well-known building blocks (SQLCipher, libsodium, Argon2id, BIP39) rather than custom cryptography, and the code is public, so you can review it yourself or ask someone you trust to.
If you find a vulnerability, please report it privately as described in the security policy, not in a public issue.