refactor: use parameters in EncryptedFile constructor

This commit is contained in:
Lukas Lihotzki 2021-04-06 18:57:34 +02:00
parent 2a2a170609
commit f69acda419
1 changed files with 6 additions and 5 deletions

View File

@ -554,11 +554,12 @@ class Event extends MatrixEvent {
if (!fileMap['key']['key_ops'].contains('decrypt')) {
throw ("Missing 'decrypt' in 'key_ops'.");
}
final encryptedFile = EncryptedFile();
encryptedFile.data = uint8list;
encryptedFile.iv = fileMap['iv'];
encryptedFile.k = fileMap['key']['k'];
encryptedFile.sha256 = fileMap['hashes']['sha256'];
final encryptedFile = EncryptedFile(
data: uint8list,
iv: fileMap['iv'],
k: fileMap['key']['k'],
sha256: fileMap['hashes']['sha256'],
);
uint8list = await runInBackground(decryptFile, encryptedFile);
}
return MatrixFile(bytes: uint8list, name: body);