User Data Restoration

How GetTrusted Restores User Data.

Overview

circle-info

We do not backup or restore enterprise data, we filter it out as managed personas and managed contacts can be recovered and should only be recovered through enterprise onboarding/recovery.

GetTrusted's Restore Flow enables automatic recovery of encrypted backups when a user recovers their identity on a new device. The system uses the same Backup Encryption Key (BEK) that was deterministically derived during identity recovery to decrypt and restore all user data (contacts, personas, trust attestations) with zero server-side decryption.

Key Security Features:

  • Automatic BEK Availability: BEK already derived and stored during identity recovery

  • Hardware-Backed BEK Storage: BEK retrieved from iOS Keychain/Android KeyStore

  • Zero-Knowledge Server: Backend retrieves encrypted blobs from S3, never sees plaintext

  • Master ID Verification: Backup Master ID must match recovered identity

  • Nuclear Table Clearing: Complete database wipe before restoration (clean slate)

  • Device ID Injection: New device's device_id injected into restored records

  • GZIP Decompression: Automatic decompression of compressed backup data

  • AES-256-GCM Decryption: Authenticated decryption with nonce-based security

Process Overview

Alice recovers her identity on a new phone using her passphrase and QR recovery data. The SDK automatically downloads and restores her encrypted backup from AWS S3, giving her immediate access to all contacts, personas, and trust attestations.

Alice's Perspective (User Recovering on New Device)

1

Identity recovery + BEK derivation

Alice recovers identity using passphrase + QR recovery data. The SDK derives the same BEK during identity recovery using HKDF-SHA256(master_id, SHA256(passphrase), "personal_bek_v1") and stores the BEK in the hardware keychain (gettrusted_bek_personal).

2

Check for backup and download

SDK checks for backup via backend API. SDK downloads the encrypted blob from S3 (zero-knowledge retrieval).

3

BEK retrieval and decryption

SDK retrieves BEK from secure storage (no user interaction). SDK decrypts and decompresses backup data (AES-256-GCM decryption + GZIP decompression).

4

Master ID verification

SDK verifies the Backup Master ID matches the recovered identity. If mismatch, abort with MasterIdMismatch error.

5

Nuclear table clearing

SDK clears existing tables (DELETE FROM contacts, personas, trust_attestations) to provide a clean slate for restoration.

6

Device ID injection & restore

SDK injects the new device_id into all restored records and regenerates created_at/updated_at timestamps. Restored records are inserted into the local database.

7

Restoration summary & completion

App shows restoration summary (contacts, personas, attestations). Alice sees all data restored and ready to use immediately.

Backend Perspective (GetTrusted API + AWS Services)

1

Receive and authenticate restore request

Restore request arrives with user_id. Backend validates the JWT token (device signature verification) and extracts the user fingerprint from the Master ID.

2

Query backup metadata

Backend queries Firestore metadata for backup existence and metadata (fingerprint, s3Key, size, exportedAt).

3

Download blob from S3

Backend downloads the encrypted blob from S3 (GET object Key: backups/{fingerprint}/backup.bin). The backend never decrypts the blob (zero-knowledge).

4

Return encrypted blob to device

Backend returns the encrypted blob and metadata to the mobile device. Mobile SDK handles decryption; backend never sees plaintext.

Process Flow Diagram

Cryptographic Security

Why BEK is Available:

  • During identity recovery, SDK calls derive_bek_personal(master_id, passphrase)

  • Derived BEK is immediately stored in hardware keychain

  • Same BEK used for backup creation is now available for restoration

  • Deterministic derivation ensures BEK is identical on any device with same Master ID + passphrase

AES-256-GCM Decryption

Encrypted Blob Structure:

┌─────────┬──────────────┬────────────────────────────────┐ │ Version │ Nonce │ Ciphertext + Authentication Tag │ │ 1 byte │ 12 bytes │ Variable (compressed data + 16) │ │ (0x01) │ (from backup)│ (AES-256-GCM output) │ └─────────┴──────────────┴────────────────────────────────┘

Security Properties:

  • Authentication Verification: 128-bit tag ensures data integrity and authenticity

  • Tamper Detection: Modified ciphertext fails to decrypt (authentication error)

  • Nonce Uniqueness: Each backup has unique nonce (extracted from blob)

  • 256-bit Key: BEK provides 256-bit security strength

  • AEAD: Decrypt-then-verify integrated (NIST-approved)

Field Injection:

  • device_id: New device's unique ID (different from backup device)

  • created_at: Current timestamp (not from backup)

  • updated_at: Current timestamp (not from backup)

Why Field Injection:

  • Each device has unique device_id tracked for security auditing

  • Timestamps reflect when record was created ON THIS DEVICE

  • Backup data (contacts, personas, trust attestations) remains intact

  • Device-specific metadata updated for new device context

Security Guarantees

1. BEK Availability Through Deterministic Derivation

  • Same Master ID + passphrase → same BEK (reproducible)

  • BEK derived during identity recovery, stored in hardware keychain

  • Retrieve BEK from secure storage for restoration (no re-derivation needed)

  • Hardware-protected storage ensures BEK security

2. Master ID Verification Before Restoration

  • Backup Master ID must match recovered identity's Master ID

  • Prevents accidental restoration of wrong user's backup

  • Cryptographic proof of identity ownership

  • Fails fast if wrong backup attempted

3. Zero-Knowledge Backend

  • Backend retrieves encrypted blob from S3 (opaque ciphertext)

  • Backend never sees BEK or plaintext data

  • Decryption happens entirely on device

  • Backend compromise does NOT expose user data

4. Hardware-Protected BEK Storage

  • BEK stored in iOS Keychain / Android KeyStore

  • Hardware-level encryption automatically applied

  • Protected by device biometrics/passcode

  • Non-exportable from device hardware

5. Authenticated Decryption

  • AES-256-GCM verifies data integrity and authenticity

  • Authentication tag prevents tampering

  • Modified ciphertext fails to decrypt

  • Wrong BEK produces authentication failure (not garbage data)

6. Nuclear Table Clearing for Clean Slate

  • Complete database wipe before restoration

  • No orphaned records or ID conflicts

  • Backup represents complete truth

  • Predictable and simple (no merge logic bugs)

7. Device ID Injection for Portability

  • New device_id injected into all restored records

  • Timestamps regenerated for new device context

  • Backup data (contacts, personas) remains intact

  • Clean migration across devices

Strategic Implications

Seamless Cross-Device Recovery

Traditional Problem:

  • User sets up new phone:

    • Manually re-add all contacts

    • Manually re-create personas

    • Lose trust attestation history

    • Hours of manual data entry

    • Risk of forgetting contacts

GetTrusted Solution:

  • User recovers identity on new phone:

    • Enter passphrase (derives same BEK)

    • SDK automatically downloads backup from S3

    • SDK automatically decrypts and restores

    • All contacts, personas, attestations appear

    • Zero manual data entry

    • Complete history preserved

    • Ready to use in seconds

Zero-Knowledge Cloud Storage

Backend Cannot:

  • Decrypt any backup data

  • Read contacts or personas

  • Access trust attestations

  • Derive BEK from encrypted blobs

  • Correlate backups across users (fingerprint-based S3 keys)

  • Restore user data without user's BEK

Backend Can:

  • Store encrypted blobs reliably (S3 durability: 99.999999999%)

  • Track backup metadata (sizes, timestamps)

  • Enable cross-device recovery (blob retrieval)

  • Audit access patterns (Firestore logs)

  • Scale storage elastically (S3 auto-scaling)

Last updated