diff --git a/lib/src/utils/crypto/encrypted_file.dart b/lib/src/utils/crypto/encrypted_file.dart index 847bf616..754e5ced 100644 --- a/lib/src/utils/crypto/encrypted_file.dart +++ b/lib/src/utils/crypto/encrypted_file.dart @@ -1,4 +1,3 @@ -// @dart=2.9 /* * Famedly Matrix SDK * Copyright (C) 2019, 2020, 2021 Famedly GmbH @@ -23,10 +22,10 @@ import 'crypto.dart'; class EncryptedFile { EncryptedFile({ - this.data, - this.k, - this.iv, - this.sha256, + required this.data, + required this.k, + required this.iv, + required this.sha256, }); Uint8List data; String k; @@ -47,7 +46,7 @@ Future encryptFile(Uint8List input) async { ); } -Future decryptFile(EncryptedFile input) async { +Future decryptFile(EncryptedFile input) async { if (base64.encode(await sha256(input.data)) != base64.normalize(input.sha256)) { return null; diff --git a/lib/src/utils/crypto/js.dart b/lib/src/utils/crypto/js.dart index 56099614..aeb72996 100644 --- a/lib/src/utils/crypto/js.dart +++ b/lib/src/utils/crypto/js.dart @@ -1,10 +1,11 @@ -// @dart=2.9 // Copyright (c) 2020 Famedly GmbH // SPDX-License-Identifier: AGPL-3.0-or-later import 'dart:typed_data'; +// ignore: import_of_legacy_library_into_null_safe import 'subtle.dart'; +// ignore: import_of_legacy_library_into_null_safe import 'subtle.dart' as subtle; abstract class Hash { diff --git a/lib/src/utils/crypto/subtle.dart b/lib/src/utils/crypto/subtle.dart index 6216c639..a850344e 100644 --- a/lib/src/utils/crypto/subtle.dart +++ b/lib/src/utils/crypto/subtle.dart @@ -1,4 +1,3 @@ -// @dart=2.9 // Copyright (c) 2020 Famedly GmbH // SPDX-License-Identifier: AGPL-3.0-or-later @@ -16,21 +15,29 @@ class CryptoKey {} @JS() @anonymous class Pbkdf2Params { - external factory Pbkdf2Params( - {String name, String hash, Uint8List salt, int iterations}); - String name; - String hash; - Uint8List salt; - int iterations; + external factory Pbkdf2Params({ + String name, + String hash, + Uint8List salt, + int iterations, + }); + String? name; + String? hash; + Uint8List? salt; + int? iterations; } @JS() @anonymous class AesCtrParams { - external factory AesCtrParams({String name, Uint8List counter, int length}); - String name; - Uint8List counter; - int length; + external factory AesCtrParams({ + String name, + Uint8List counter, + int length, + }); + String? name; + Uint8List? counter; + int? length; } @JS('crypto.subtle.encrypt')