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')) { if (!fileMap['key']['key_ops'].contains('decrypt')) {
throw ("Missing 'decrypt' in 'key_ops'."); throw ("Missing 'decrypt' in 'key_ops'.");
} }
final encryptedFile = EncryptedFile(); final encryptedFile = EncryptedFile(
encryptedFile.data = uint8list; data: uint8list,
encryptedFile.iv = fileMap['iv']; iv: fileMap['iv'],
encryptedFile.k = fileMap['key']['k']; k: fileMap['key']['k'],
encryptedFile.sha256 = fileMap['hashes']['sha256']; sha256: fileMap['hashes']['sha256'],
);
uint8list = await runInBackground(decryptFile, encryptedFile); uint8list = await runInBackground(decryptFile, encryptedFile);
} }
return MatrixFile(bytes: uint8list, name: body); return MatrixFile(bytes: uint8list, name: body);