Encrypt a note's contents while keeping its title visible. Locked notes
stay as ordinary .md files โ they show up in the file explorer, graph, and
links by name โ but their body is sealed with authenticated encryption until you
unlock them with a password.
- ๐ Lock / unlock individual notes via commands, the ribbon icon, or the file context menu.
- ๐๏ธ Two key models:
- Vault password โ one password (cached in memory for the session) unlocks every note locked with the vault default.
- Per-note password โ lock a sensitive note with its own password.
- ๐งฎ Strong crypto โ PBKDF2 (SHA-256, 310k iterations by default) derives an AES-GCM-256 key. Each note gets a fresh random salt and IV, and GCM authentication means a wrong password fails cleanly instead of returning garbage.
- โฑ๏ธ Auto-lock โ re-encrypt a note when you navigate away, after an inactivity timeout, and on Obsidian quit. The cached vault password expires after a configurable interval.
- โ Encryption self-check โ before a note's plaintext is overwritten, the freshly-made ciphertext is decrypted and compared to the original. If it doesn't match, the lock is aborted and the note is left untouched, so a faulty lock can never silently destroy content.
- ๐ก Status-bar indicator โ shows how many notes are currently unlocked (i.e. have plaintext on disk). Click it to lock everything at once.
- ๐ช Password-strength hint โ a meter on the lock dialog nudges you away from trivial passwords.
- ๐ Plain
.mdstorage โ the encrypted payload lives in a fenced```lockerblock, so locked notes still sync, back up, and version like any other note.
Once approved: in Obsidian go to Settings โ Community plugins โ Browse, search for Lockbox, install, then enable it.
Download main.js, manifest.json, and styles.css from the
latest release and
place them in <your-vault>/.obsidian/plugins/lockbox/, then enable
Lockbox under Settings โ Community plugins.
Track pre-release builds by adding the repo danzar/Obsidian-Locker in the
BRAT plugin.
---
locker: true
locker-scope: vault
---
> [!lock]- ๐ Encrypted with Lockbox
> This note is locked. Run **Lockbox: Unlock note** (or click the ribbon lock
> icon) to decrypt it.
```locker
{"v":1,"alg":"AES-GCM","kdf":"PBKDF2","hash":"SHA-256","iterations":310000,"salt":"โฆ","iv":"โฆ","ct":"โฆ","scope":"vault"}
```The note's own frontmatter and body are encrypted together inside ct, so
nothing of the original content leaks โ only the filename stays readable.
This plugin gives you encryption at rest while a note is locked. Be aware of the tradeoffs of in-place editing:
- While a note is unlocked, its plaintext is written to disk so you can edit it as a normal note. Auto-lock-on-close (on by default), the inactivity timer (5 min default), and a best-effort lock on quit shrink this window. If the app crashes or is force-quit while a note is unlocked, plaintext can remain on disk โ on the next launch Lockbox detects this from a recovery ledger and prompts you to run Lockbox: Secure notes left exposed.
- There is no password recovery. Forget a password and the note is unrecoverable. Keep backups of anything important.
- The vault password is held in memory only and never persisted. It is cleared on quit and after the "forget" timeout.
- This is defense against casual/at-rest access (a synced file, a shared machine), not a guarantee against a determined attacker with live access to your unlocked vault.
The lock/unlock paths are written to avoid the data-loss traps of editing files that may be open or syncing:
- Live buffer is the source of truth. When a note is open, Lockbox reads the editor's current contents (including unsaved keystrokes) rather than stale disk content, so locking never encrypts away your latest edits.
- Atomic, checked writes. Encryption can take a moment; if the file changes during that window (you keep typing, or a sync client writes it), Lockbox detects the change and aborts rather than overwriting โ the note simply stays unlocked so you can retry.
- Self-check before overwrite (see above) guarantees the ciphertext decrypts back to the original before the plaintext is replaced.
- Rename/delete aware. Renaming or moving an unlocked note keeps it tracked so auto-lock still re-encrypts it at its new path.
| Action | How |
|---|---|
| Lock the active note with the vault password | Command Lockbox: Lock note (vault password) or the ribbon lock icon |
| Lock with a separate password | Command Lockbox: Lock note with a separate password |
| Unlock the active note | Command Lockbox: Unlock note, ribbon icon, or just run unlock |
| Re-encrypt everything now | Command Lockbox: Lock all currently-unlocked notes |
| Lock/unlock a whole folder | Right-click a folder โ Lockbox: lock all notes in folder / unlock all notes in folder |
| Lock/unlock the entire vault | Commands Lockbox: Lock every note in the vault / Unlock every vault-password note in the vault |
| Clear the cached vault password | Command Lockbox: Forget vault password (lock session) |
| Re-secure notes left exposed by a crash | Command Lockbox: Secure notes left exposed (only available when needed) |
- Auto-lock on close โ re-encrypt a note when you navigate away (default on).
- Auto-lock after inactivity โ minutes before an idle unlocked note re-locks
(
0= off). - Forget vault password after โ minutes the vault password stays cached
(
0= until quit). - Key derivation iterations โ PBKDF2 iterations for newly locked notes.
- Verify before overwriting โ round-trip-check each lock before replacing the note (default on; roughly doubles lock time).
npm install # install deps
npm run dev # watch build -> main.js
npm run build # type-check + production bundle
npm test # crypto + format round-trip testsCopy manifest.json, main.js, and styles.css into
<your-vault>/.obsidian/plugins/lockbox/, then enable Lockbox under
Settings โ Community plugins. (Re-run npm run build to refresh main.js.)
From a third adversarial review focused on new bugs and gaps:
- Mobile: re-lock on app background (
visibilitychange/pagehide) โ the only reliable re-lock signal on mobile, where quit/onunloaddon't fire and timers freeze. Ribbon icon now also indicates unlocked state (the status bar is hidden on mobile). - Crash recovery: the ledger now records each note's scope, so "secure notes left exposed" re-locks separate-password notes at their own scope (prompting for a new password) instead of silently re-keying them to the vault password.
- Concurrency:
lock allbacks off during a bulk run; a note open in two panes no longer lets a stale buffer clobber the ciphertext; a still-visible note isn't prematurely auto-locked; recovery keeps notes it couldn't secure. - UX: reading-view placeholder instead of the raw base64 block; ConfirmModal keyboard support (Enter/Escape, Cancel focused); "busy"/"cancelled" feedback; clearer non-markdown message; better password-strength scoring; settings revert invalid input on blur.
- Dropped the
builtin-modulesdevDependency in favor of Node's nativenode:modulebuiltinModules(resolves an Obsidian review warning).
- Renamed the plugin to Lockbox (id
lockbox). The previous name/idobsidian-lockercouldn't be used โ the community store forbidsobsidianin plugin ids, andnote-locker/Note Lockerwas already taken. The on-disk marker stayslockerinternally for compatibility. - Added a GitHub Actions release workflow that builds and attaches
main.js/manifest.json/styles.csson a version tag. - Installation instructions (store, manual, BRAT).
- Folder & vault lock/unlock: right-click a folder, or use the Lock/Unlock-vault commands. Built on the same safe-write path (live-buffer read, atomic change-checked writes, per-path mutex, self-check).
- Bulk unlock skips per-note-password notes and reports them; a confirmation prompt guards mass operations.
- Hardened after a second adversarial review: per-note ledger persistence during bulk unlock (crash recovery), accurate skipped/changed/failed accounting, no spurious password-forgetting, auto-lock backs off during bulk runs, and the progress notice always clears.
Following an adversarial multi-agent review:
- Read the live editor buffer when locking an open note (no more lost unsaved edits); atomic writes with change-detection abort instead of clobbering concurrent/sync edits.
- Crash-recovery ledger: detect and re-secure notes left as plaintext after an unclean shutdown.
- Rename/delete handlers keep unlocked notes tracked and re-lockable.
- CRLF-tolerant, frontmatter-anchored locked-note detection (fixes Windows/sync lockouts and false positives).
- Decrypt now validates algorithm/KDF/iteration/salt/IV parameters.
- Per-path concurrency guard; single sweep timer; safer settings validation; non-zero inactivity auto-lock default.
- Full orchestration test suite for the lock/unlock/relock lifecycle.
Self-check before overwrite, status-bar indicator, password-strength hint.
Initial MVP: lock/unlock, vault & per-note passwords, AES-GCM/PBKDF2, settings.
GNU General Public License v3.0 (GPL-3.0-or-later) ยฉ 2025 Zarware. See
LICENSE.