FieldEncryptor class

Provides deterministic AES encryption for database fields. Useful for encrypting sensitive data while maintaining searchability.

⚠️ SECURITY NOTE: Uses deterministic IV for searchability. This means identical plaintexts produce identical ciphertexts. Trade-off: searchability vs perfect forward secrecy.

Constructors

FieldEncryptor({required String dbSecretKey, required String salt})
Creates a FieldEncryptor. dbSecretKey must be base64-encoded 32-byte key. salt should be unique per application/environment.

Properties

dbSecretKey String
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
salt String
final

Methods

decrypt(String encryptedValue) → Result<String>
Decrypts an encrypted string value.
encrypt(String value) → Result<String>
Encrypts a string value using deterministic AES encryption.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited