key property

List<int> key
final

Encryption key (must be 32 bytes for AES-256 and ChaCha20).

IMPORTANT: Store this key securely using:

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

Generate using:

import 'dart:math';
import 'dart:typed_data';

Uint8List generateSecureKey() {
  final random = Random.secure();
  return Uint8List.fromList(
    List.generate(32, (_) => random.nextInt(256)),
  );
}

Implementation

final List<int> key;