Skip to content

Android seed encryption and plaintext migration #229

Description

@DevAnuragT

Body:

Context

Android production currently stores the wallet mnemonic in plaintext:

Proposed design

  1. Encrypt seed_phrase with AES-256-GCM.
  2. Store the encryption key in Android Keystore, without interactive user authentication.
  3. Use StrongBox when available, with a TEE/software fallback.
  4. Introduce one seed-storage abstraction used by NodeService, StabilityProcessingService, and AppState.
  5. Migrate in stages:
    • Shadow-write seed_encrypted; keep plaintext authoritative.
    • Read encrypted storage first, with plaintext fallback.
    • After validation, verify decrypt success and delete seed_phrase.
  6. Preserve keys_seed migration support.
  7. Delete seed_encrypted and the Keystore key during wallet reset.

Required invariants

  • Never delete plaintext before a successful encrypted write and verified decrypt.
  • Never generate a replacement key when encrypted data already exists.
  • Decryption failure must not silently start a different wallet.
  • Background services must decrypt without user interaction.
  • Do not log seed material or include it in telemetry.

@toneloc Please review the Android storage design, migration behavior, failure handling, and phased rollout before implementation begins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions