Infrastructure medium complexity mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Bootstraps the SQLCipher encryption key used by the Drift database at app startup. Retrieves or generates a device-bound AES-256 key from the Flutter secure storage (platform keychain on iOS, Android Keystore on Android), ensuring the local database is encrypted at rest and the key is never stored in plaintext.

Feature: Offline Data Support

sqlcipher-encryption-config

Responsibilities

  • Retrieve existing encryption key from platform secure storage on app launch
  • Generate and persist a new AES-256 key on first run if none exists
  • Provide the resolved key to the Drift database open call
  • Handle key migration scenarios across app reinstalls where the keychain entry survives

Interfaces

getOrCreateEncryptionKey(): Future<String>
rotateKey(newKey): Future<void>