EncryptionConfig

Configures built-in encryption mode and key.

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class EncryptionConfig {
  const EncryptionConfig(
      {this.encryptionMode,
      this.encryptionKey,
      this.encryptionKdfSalt,
      this.datastreamEncryptionEnabled});

  @JsonKey(name: 'encryptionMode')
  final EncryptionMode? encryptionMode;

  @JsonKey(name: 'encryptionKey')
  final String? encryptionKey;

  @JsonKey(name: 'encryptionKdfSalt', ignore: true)
  final Uint8List? encryptionKdfSalt;

  @JsonKey(name: 'datastreamEncryptionEnabled')
  final bool? datastreamEncryptionEnabled;

  factory EncryptionConfig.fromJson(Map<String, dynamic> json) =>
      _$EncryptionConfigFromJson(json);

  Map<String, dynamic> toJson() => _$EncryptionConfigToJson(this);
}

Properties

encryptionMode
Built-in encryption mode. See EncryptionMode. It is recommended to use aes128Gcm2 or aes256Gcm2 encryption modes. These two modes support salt and offer higher security.
encryptionKey
Built-in encryption key, of type String, with no length limit. It is recommended to use a 32-byte key.
Note: If this parameter is not specified or set to NULL, built-in encryption cannot be enabled, and the SDK returns error code -2.
encryptionKdfSalt
Salt, 32 bytes in length. It is recommended to generate the salt on the server side using OpenSSL.
Note: This parameter takes effect only when using aes128Gcm2 or aes256Gcm2 encryption modes. In this case, ensure that the value provided for this parameter is not all 0.
datastreamEncryptionEnabled
Whether to enable data stream encryption:
  • true: Enable data stream encryption.
  • false: (Default) Disable data stream encryption.