EncryptionConfig class
Configuration for data encryption at rest.
SyncLayer encrypts data before storing it locally and decrypts it when reading. This ensures data security even if the device is compromised.
Example:
final encryptionKey = await generateSecureKey();
await SyncLayer.init(
SyncConfig(
baseUrl: 'https://api.example.com',
encryption: EncryptionConfig(
enabled: true,
key: encryptionKey,
algorithm: EncryptionAlgorithm.aes256GCM,
),
),
);
Constructors
-
EncryptionConfig({required bool enabled, required List<
int> key, EncryptionAlgorithm algorithm = EncryptionAlgorithm.aes256GCM, bool encryptFieldNames = false, bool compressBeforeEncryption = true}) -
const
- EncryptionConfig.disabled()
-
Create a disabled encryption config.
const
Properties
- algorithm → EncryptionAlgorithm
-
Encryption algorithm to use.
final
- compressBeforeEncryption → bool
-
Whether to compress data before encryption.
final
- enabled → bool
-
Whether encryption is enabled.
final
- encryptFieldNames → bool
-
Whether to encrypt field names (in addition to values).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
key
→ List<
int> -
Encryption key (must be 32 bytes for AES-256 and ChaCha20).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited