Encrypt tagged entries on save; whole-file encryption !489

open opened by cmc on 2026-11-26 08:44 UTC · krz/orgstar:m5-crypt into main

Discussion

cmc 2026-11-26 08:44 UTC

Closes #153.

Part 1: org-crypt-use-before-save-magic in config.toml (off by default). A crypt layer (CryptVault, CryptFileSystem, CryptRecoveryStore in OrgDocument) sits under the session's file system and recovery store: buffers keep decrypted text, disk gets messages. Unchanged decrypted entries get their old message back, as org-crypt does. Without the passphrase the whole file is held: no write, no recovery version or snapshot; a notice with Encrypt… shows above the mode line (Mac) and at the top of the editor (iOS). The Keychain (with Touch ID, Face ID or the device password) is asked once per open file. Quit and close on the Mac ask for the passphrase or Don't Save. iOS keeps held edits in memory and names lost files at the next launch. Buffers with decrypted entries, and .org.gpg buffers, are left out of openTexts (agenda, widgets, watch, reminders).

Part 2: .org.gpg open and save, symmetric, binary (armored when read armored), compatible with gpg and EasyPG. Passphrase from the Keychain or a prompt, with Remember offered. Recovery versions are kept encrypted; merges happen in memory; the index, Spotlight and Quick Look never read the file. age is not implemented.

Tests: CryptSaveTests (file, recovery folder, index database, held state, byte-identical messages, Replace in Files, restore, fileWritten) and CryptFileTests (seal, gpg both ways, Emacs EasyPG both ways, org-crypt reuse oracle). swift test and both Xcode builds pass.

Needs a device: Face ID and Touch ID prompt frequency, the iOS notice and reader unlock screens, the message after iOS ends the app while a file is held.

Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form