remove obsolete comments

This commit is contained in:
Sorunome 2020-05-30 13:19:39 +02:00
parent 41a08d4c28
commit 44e4b07999
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C
2 changed files with 2 additions and 4 deletions

View file

@ -63,7 +63,6 @@ class KeyManager {
return;
}
// TODO: check if pubkey is valid
for (final roomEntries in payload['rooms'].entries) {
final roomId = roomEntries.key;
if (!(roomEntries.value is Map) || !(roomEntries.value['sessions'] is Map)) {

View file

@ -70,16 +70,15 @@ class SSSS {
static String decryptAes(_Encrypted data, Uint8List key, String name) {
final keys = deriveKeys(key, name);
final cipher = base64.decode(data.ciphertext);
final hmac = base64
.encode(Hmac(sha256, keys.hmacKey)
.convert(base64.decode(data.ciphertext))
.convert(cipher)
.bytes)
.replaceAll(RegExp(r'=+$'), '');
if (hmac != data.mac.replaceAll(RegExp(r'=+$'), '')) {
throw 'Bad MAC';
}
// workaround for https://github.com/leocavalcante/encrypt/issues/136
final cipher = base64.decode(data.ciphertext);
final decipher = AES(Key(keys.aesKey), mode: AESMode.ctr, padding: null)
.decrypt(Encrypted(cipher), iv: IV(base64.decode(data.iv)));
return String.fromCharCodes(decipher);