make memLimit and opsLimit non-nullable and remove null check

This commit is contained in:
ashilkn 2022-09-21 15:39:38 +05:30
parent 51eb2cceff
commit f2adc32b4b
2 changed files with 3 additions and 3 deletions

View file

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

View file

@ -25,7 +25,7 @@ void validatePreVerificationStateCheck(
"secretKeyDecryptionNonce",
);
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");
}
// check password encoding issues