AndroidOptions constructor

const AndroidOptions({
  1. bool resetOnError = true,
  2. bool migrateOnAlgorithmChange = true,
  3. bool migrateWithBackup = false,
  4. bool enforceBiometrics = false,
  5. KeyCipherAlgorithm keyCipherAlgorithm = KeyCipherAlgorithm.RSA_ECB_OAEPwithSHA_256andMGF1Padding,
  6. StorageCipherAlgorithm storageCipherAlgorithm = StorageCipherAlgorithm.AES_GCM_NoPadding,
  7. AndroidBiometricType biometricType = AndroidBiometricType.biometricOrDeviceCredential,
  8. bool requireBiometricConfirmation = true,
  9. String? preferencesKeyPrefix,
  10. String? storageNamespace,
  11. String? biometricPromptTitle,
  12. String? biometricPromptSubtitle,
  13. String? biometricPromptNegativeButton,
})

Standard secure storage using AES-GCM with RSA OAEP key wrapping.

This is the default constructor with strong security:

  • RSA/ECB/OAEPWithSHA-256AndMGF1Padding for key protection
  • AES/GCM/NoPadding for data encryption
  • No biometric authentication required
  • API 23+ (Android 6.0+)

For biometric authentication, use AndroidOptions.biometric().

Advanced users can customize cipher algorithms for specific use cases:

  • AES_GCM_NoPadding storage + RSA key ciphers (standard RSA wrapping)
  • AES_GCM_NoPadding storage + AES_GCM_NoPadding key (KeyStore-based, supports biometrics)

Implementation

const AndroidOptions({
  bool resetOnError = true,
  bool migrateOnAlgorithmChange = true,
  bool migrateWithBackup = false,
  bool enforceBiometrics = false,
  KeyCipherAlgorithm keyCipherAlgorithm =
      KeyCipherAlgorithm.RSA_ECB_OAEPwithSHA_256andMGF1Padding,
  StorageCipherAlgorithm storageCipherAlgorithm =
      StorageCipherAlgorithm.AES_GCM_NoPadding,
  AndroidBiometricType biometricType =
      AndroidBiometricType.biometricOrDeviceCredential,
  bool requireBiometricConfirmation = true,
  this.preferencesKeyPrefix,
  this.storageNamespace,
  this.biometricPromptTitle,
  this.biometricPromptSubtitle,
  this.biometricPromptNegativeButton,
}) : _resetOnError = resetOnError,
     _migrateOnAlgorithmChange = migrateOnAlgorithmChange,
     _migrateWithBackup = migrateWithBackup,
     _enforceBiometrics = enforceBiometrics,
     _keyCipherAlgorithm = keyCipherAlgorithm,
     _storageCipherAlgorithm = storageCipherAlgorithm,
     _biometricType = biometricType,
     _requireBiometricConfirmation = requireBiometricConfirmation;