mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-03 16:41:27 +01:00
feat: mirror the diary to Proton Drive as a device
The data directory is the whole diary, and until now keeping a copy of it was someone's manual job. The server can now register itself in Proton Drive as a device — its own sync root, next to the desktop clients — and keep that folder equal to DIARY_DATA_DIR, encrypted client-side by the same Rust SDK the Linux client uses. One interactive `narl-diary proton-login`, then nothing prompts again. The stored session carries the tokens, the mailbox password (the key chain is rebuilt from it on every start) and the account key salts, which have to be captured at login: `core/v4/keys/salts` needs the `locked` scope, and only a password-login token has it. Refresh tokens are single-use, so every rotation is written back before it can be needed. It lives as a 0600 file next to the database, on the same volume as the data it protects; `--features keyring` puts it in the OS keyring instead, for hosts that have a Secret Service. The mirror is one-way and change-driven: writes mark the diary dirty and it is mirrored once the writing stops, with an interval as the backstop — an hour of writing is one backup, not sixty. `diary.db` goes up as a VACUUM INTO snapshot, so it is a real point in time rather than a file copied out from under a writer, and as a new revision each time, so Proton keeps the older ones. Uploads are immutable, so they are written once and skipped by size afterwards. Deletions do not propagate unless asked: a backup that forgets on command is one accident away from being no backup at all. Identification follows Proton's third-party rules — an honest `external-drive-narl_diary@<version>-alpha`, the disclosure printed before any credential is asked for, and remembered folder uids instead of walking the tree every run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5Gk8FPkRXu1e6Nj2BCRE1
This commit is contained in:
1 parent
c606169b01
commit
bac8a4c1d4
21 files changed
+4229
-46
No files matched your search
+14
@@ -28,6 +28,20 @@ regex = "1"
|
||||
anyhow = "1"
|
||||
zip = { version = "2", default-features = false, features = ["deflate"] }
|
||||
tempfile = "3.27.0"
|
||||
# Only for `--features keyring`, on a host that has a Secret Service; the
|
||||
# container deployment has no session bus and falls back to the session file.
|
||||
keyring = { version = "3", features = ["sync-secret-service", "crypto-rust"], optional = true }
|
||||
|
||||
proton-drive-rs = "0.6.2"
|
||||
proton-sdk = "0.6.2"
|
||||
rpassword = "7"
|
||||
hex = "0.4"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
# Keep the Proton session in the OS keyring instead of a 0600 file. Needs a
|
||||
# Secret Service on D-Bus, so it is off for the container deployment.
|
||||
keyring = ["dep:keyring"]
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
|
||||
Reference in new issue
Block a user