encryption property

EncryptionConfig encryption
final

Encryption configuration for data at rest.

Encrypts data before storing locally and decrypts when reading. Essential for:

  • Enterprise: Healthcare, finance, legal apps MUST have encryption
  • Compliance: HIPAA, GDPR, SOC2 require encryption at rest
  • Trust: Users expect their data to be encrypted
  • Security: Protects data if device is compromised

Example:

final encryptionKey = await generateSecureKey();

encryption: EncryptionConfig(
  enabled: true,
  key: encryptionKey,
  algorithm: EncryptionAlgorithm.aes256GCM,
)

IMPORTANT: Store encryption key securely using:

  • flutter_secure_storage
  • Platform keychain (iOS Keychain, Android Keystore)
  • Never hardcode or commit to version control

Implementation

final EncryptionConfig encryption;