encryptWithKey method

  1. @override
Future<EncryptionResult> encryptWithKey(
  1. List<int> data,
  2. EncryptionKey key
)
override

Provided some binary data and a SymmetricKey (key type dependant on the encryption scheme being used) Return an EncryptionResult

Implementation

@override
Future<EncryptionResult> encryptWithKey(
    List<int> data, EncryptionKey key) async {
  assert(key is SymmetricKey, 'AES requires a `SymmetricKey`');
  final artefacts = EncryptionArtefacts(
    authData: utf8.encode('none'),
    authTag: utf8.encode('none'),
    salt: SecretKeyData.random(length: _saltBytesLength).bytes,
  );
  return encryptWithKeyAndArtefacts(data, key, artefacts);
}