roberto 4cd382b829 step 4.1+4.2 complete: E2E encrypted backup + offline sync queue
- e2e-crypto.ts: Argon2id key derivation (time=3, mem=64MB) + AES-256-GCM
  encrypt/decrypt + SHA-256 checksum + ADV1 blob packing (salt+IV+authTag+ciphertext)
- backup-manager.ts: createBackup (WAL snapshot → encrypt → upload), restoreBackup
  (download → verify → decrypt → atomic file swap → reinit DB → notify renderer),
  getHistory, deleteBackup, schedulePeriodicBackup (setInterval, default 24h)
- sync-queue.ts: enqueues failed backup intents in sync_queue table; processQueue
  retries up to 5×; triggered automatically on WS reconnect via onConnected()
- backend-client.ts: uploadBackup (raw PUT /api/v1/backup with custom headers),
  downloadBackup (If-Modified-Since / 304 support), onConnected() event hook
- auth-manager.ts: password cached in memory at login/register, cleared at logout,
  getCachedPassword() for BackupManager — never persisted to disk
- store.ts: backupEnabled, backupIntervalHours, lastBackupAt settings
- db/schema.ts: sync_queue table (id, action, payload, status, retries, timestamps)
- db/index.ts: getRawSqlite() for .backup() API, getDbPath(), closeDb() for restore
- router/index.ts: backupRouter (create/restore/history/delete/settings/updateSettings);
  login starts periodic backup; logout stops it
- index.ts: backup scheduler wired to app lifecycle; will-quit cleans up timer
- package.json: argon2 added

Backend integration: PUT/GET /api/v1/backup already fully implemented; no
backend changes needed. Tier gating (free=0, pro=5GB, power=25GB) enforced
server-side. Backend only verifies SHA-256 checksum — never decrypts.
2026-03-05 22:56:10 +01:00
Description
No description provided
7.6 MiB
Languages
TypeScript 97.9%
CSS 2%