Explorar o código

make memLimit and opsLimit non-nullable and remove null check

ashilkn %!s(int64=2) %!d(string=hai) anos
pai
achega
f2adc32b4b
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  1. 2 2
      lib/models/key_attributes.dart
  2. 1 1
      lib/utils/validator_util.dart

+ 2 - 2
lib/models/key_attributes.dart

@@ -7,8 +7,8 @@ class KeyAttributes {
   final String publicKey;
   final String publicKey;
   final String encryptedSecretKey;
   final String encryptedSecretKey;
   final String secretKeyDecryptionNonce;
   final String secretKeyDecryptionNonce;
-  final int? memLimit;
-  final int? opsLimit;
+  final int memLimit;
+  final int opsLimit;
   final String masterKeyEncryptedWithRecoveryKey;
   final String masterKeyEncryptedWithRecoveryKey;
   final String masterKeyDecryptionNonce;
   final String masterKeyDecryptionNonce;
   final String recoveryKeyEncryptedWithMasterKey;
   final String recoveryKeyEncryptedWithMasterKey;

+ 1 - 1
lib/utils/validator_util.dart

@@ -25,7 +25,7 @@ void validatePreVerificationStateCheck(
     "secretKeyDecryptionNonce",
     "secretKeyDecryptionNonce",
   );
   );
   nullOrEmptyArgCheck(keyAttr.publicKey, "publicKey");
   nullOrEmptyArgCheck(keyAttr.publicKey, "publicKey");
-  if ((keyAttr.memLimit ?? 0) <= 0 || (keyAttr.opsLimit ?? 0) <= 0) {
+  if (keyAttr.memLimit <= 0 || keyAttr.opsLimit <= 0) {
     throw ArgumentError("Key mem/OpsLimit can not be null or <0");
     throw ArgumentError("Key mem/OpsLimit can not be null or <0");
   }
   }
   // check password encoding issues
   // check password encoding issues