Skip to content

End-to-end encrypt scheduled backups - #294

Merged
broisnees merged 2 commits into
nightlyfrom
backup-encryption
Nov 18, 2026
Merged

broisnees merged 2 commits into
nightlyfrom
backup-encryption

Conversation

@broisnees

Copy link
Copy Markdown
Collaborator

App side (server: stroke-app/stroke-web#68, live).

  • Encrypt before upload (src-tauri/src/backup_crypto.rs): a fresh 32-byte data key per backup, the gzip streamed through XChaCha20-Poly1305 in 64 KiB chunks (counter + last-chunk flag in the nonce, header as AAD, so truncation, reordering and tampering fail). The data key is wrapped with the account's sync key. Stroke Cloud requires it; S3 gets it whenever sync is set up (.sql.gz.stroke).
  • Restore opens encrypted and gzipped backups transparently with the local sync key; the restore screen says when a file is encrypted.
  • Sync reset on a device that still has the old key re-wraps every backup key under the new one, so old backups keep opening.
  • Schedule dialog: Stroke Cloud needs sync unlocked on this computer; a line says the backup is encrypted here and that losing the passphrase means nobody can open it.
  • Test vectors for the website's decryptor and unlock, both checked against it.

Tests: backup_crypto 4 passed (chunk edges, wrong key, truncation, tampering, re-wrap), backup/sync/cloud_backup 35 passed, vitest 1806 passed, svelte-check 0 errors, design lint clean.

Backups are encrypted on the user's computer before upload: chunked
XChaCha20-Poly1305 with a fresh key per backup, wrapped with the account's
sync key (src-tauri/src/backup_crypto.rs). Stroke Cloud requires it; S3 gets
it when sync is set up. Restore opens encrypted and gzipped files, and a sync
reset re-wraps existing backup keys under the new sync key.
@broisnees
broisnees merged commit 5f4094b into nightly Nov 18, 2026
1 check passed
@broisnees
broisnees deleted the backup-encryption branch November 18, 2026 07:09
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant