sojorn/zero_knowledge_backup_summary.md

1.9 KiB

Zero Knowledge Cloud Backup - Implementation Summary

Status: COMPLETE & DEPLOYED

1. Security Architecture (Zero Knowledge)

  • Principle: The server never sees your private keys.
  • Cloud Backups: Default to Messages Only. The payload contains encrypted message history but explicitly excludes the key pairs needed to decrypt them.
  • Local Backups: Must be used to backup Keys + Messages. This is the only way to restore your identity (Subjective Identity).
  • Encryption: All data is encrypted client-side using Argon2id (password derivation) and AES-GCM (content encryption) before leaving the device.

2. Frontend Implementation (Flutter)

  • Service: Rebuilt LocalKeyBackupService.dart to handle the dual-mode backup logic.
  • UI:
    • Added toggle for "Cloud" vs "Local" backup.
    • "Secure Mode" indicator when uploading to cloud (confirming keys are excluded).
    • Explicit warning: "NOT RECOMMENDED for cloud backups. Keep keys local."

3. Backend Implementation (Go)

  • Endpoints: POST /backups/upload and GET /backups/download are active.
  • Storage: Stores opaque encrypted_blob, salt, nonce, and mac.
  • Database:
    • Applied migration 000003_e2ee_backup_recovery.
    • Created tables: cloud_backups, backup_preferences, user_devices.

4. Deployment Details

  • Server: 194.238.28.122
  • Service: sojorn-api (Restarted at ~01:55 server time)
  • Database: Migrations applied successfully via migrate-linux tool.

5. How to Test

  1. Create Identity Backup: Go to "Full Backup & Recovery" -> Select "Local File" -> "Export Backup". Save this file safely!
  2. Cloud Upload: Switch to "Cloud Backup" -> Encrypt with password -> "Upload Backup".
  3. Restore Flow:
    • Wipe app / New Device.
    • Step 1: "Import Backup" using your Local File (Restores Identity/Keys).
    • Step 2: "Download & Restore" from Cloud (Restores Message History).