Browse Source

KeyAttributes: make more fields nullable

Neeraj Gupta 2 years ago
parent
commit
11da7a4aae
3 changed files with 6 additions and 6 deletions
  1. 2 2
      lib/core/configuration.dart
  2. 2 2
      lib/models/key_attributes.dart
  3. 2 2
      lib/services/user_service.dart

+ 2 - 2
lib/core/configuration.dart

@@ -374,9 +374,9 @@ class Configuration {
     Uint8List masterKey;
     try {
       masterKey = await CryptoUtil.decrypt(
-        Sodium.base642bin(attributes!.masterKeyEncryptedWithRecoveryKey),
+        Sodium.base642bin(attributes!.masterKeyEncryptedWithRecoveryKey!),
         Sodium.hex2bin(recoveryKey),
-        Sodium.base642bin(attributes.masterKeyDecryptionNonce),
+        Sodium.base642bin(attributes.masterKeyDecryptionNonce!),
       );
     } catch (e) {
       _logger.severe(e);

+ 2 - 2
lib/models/key_attributes.dart

@@ -9,8 +9,8 @@ class KeyAttributes {
   final String secretKeyDecryptionNonce;
   final int? memLimit;
   final int? opsLimit;
-  final String masterKeyEncryptedWithRecoveryKey;
-  final String masterKeyDecryptionNonce;
+  final String? masterKeyEncryptedWithRecoveryKey;
+  final String? masterKeyDecryptionNonce;
   final String? recoveryKeyEncryptedWithMasterKey;
   final String? recoveryKeyDecryptionNonce;
 

+ 2 - 2
lib/services/user_service.dart

@@ -414,8 +414,8 @@ class UserService {
   Future<void> setRecoveryKey(KeyAttributes keyAttributes) async {
     try {
       final setRecoveryKeyRequest = SetRecoveryKeyRequest(
-        keyAttributes.masterKeyEncryptedWithRecoveryKey,
-        keyAttributes.masterKeyDecryptionNonce,
+        keyAttributes.masterKeyEncryptedWithRecoveryKey!,
+        keyAttributes.masterKeyDecryptionNonce!,
         keyAttributes.recoveryKeyEncryptedWithMasterKey!,
         keyAttributes.recoveryKeyDecryptionNonce!,
       );