diff --git a/src/characters/pre-recipient.ts b/src/characters/pre-recipient.ts index f321c34cb..059c89eb6 100644 --- a/src/characters/pre-recipient.ts +++ b/src/characters/pre-recipient.ts @@ -185,15 +185,11 @@ export class PreDecrypter { } public equals(other: PreDecrypter): boolean { - return ( - this.porter.porterUrl.toString() === other.porter.porterUrl.toString() && - this.policyEncryptingKey.equals(other.policyEncryptingKey) && - // TODO: Replace with `equals` after https://github.com/nucypher/nucypher-core/issues/56 is fixed - bytesEquals( - this.encryptedTreasureMap.toBytes(), - other.encryptedTreasureMap.toBytes() - ) && - this.publisherVerifyingKey.equals(other.publisherVerifyingKey) - ); + return [ + this.porter.porterUrl.toString() === other.porter.porterUrl.toString(), + this.policyEncryptingKey.equals(other.policyEncryptingKey), + this.encryptedTreasureMap.equals(other.encryptedTreasureMap), + this.publisherVerifyingKey.equals(other.publisherVerifyingKey), + ].every(Boolean); } } diff --git a/src/conditions/condition-expr.ts b/src/conditions/condition-expr.ts index 5cc032c5e..61c446e53 100644 --- a/src/conditions/condition-expr.ts +++ b/src/conditions/condition-expr.ts @@ -95,9 +95,9 @@ export class ConditionExpression { } public equals(other: ConditionExpression): boolean { - return ( - this.version === other.version && - objectEquals(this.condition.toObj(), other.condition.toObj()) - ); + return [ + this.version === other.version, + objectEquals(this.condition.toObj(), other.condition.toObj()), + ].every(Boolean); } } diff --git a/src/dkg.ts b/src/dkg.ts index 16208ebcd..99f688792 100644 --- a/src/dkg.ts +++ b/src/dkg.ts @@ -75,12 +75,11 @@ export class DkgRitual { } public equals(other: DkgRitual): boolean { - return ( - this.id === other.id && - // TODO: Replace with `equals` after https://github.com/nucypher/nucypher-core/issues/56 is fixed - bytesEquals(this.dkgPublicKey.toBytes(), other.dkgPublicKey.toBytes()) && - this.threshold === other.threshold - ); + return [ + this.id === other.id, + this.dkgPublicKey.equals(other.dkgPublicKey), + this.threshold === other.threshold, + ].every(Boolean); } } diff --git a/src/sdk/strategy/cbd-strategy.ts b/src/sdk/strategy/cbd-strategy.ts index b53dac400..9d86e0a95 100644 --- a/src/sdk/strategy/cbd-strategy.ts +++ b/src/sdk/strategy/cbd-strategy.ts @@ -110,9 +110,9 @@ export class DeployedCbdStrategy { } public equals(other: DeployedCbdStrategy) { - return ( - this.decrypter.equals(other.decrypter) && - bytesEqual(this.dkgPublicKey.toBytes(), other.dkgPublicKey.toBytes()) - ); + return [ + this.decrypter.equals(other.decrypter), + this.dkgPublicKey.equals(other.dkgPublicKey), + ].every(Boolean); } } diff --git a/src/sdk/strategy/pre-strategy.ts b/src/sdk/strategy/pre-strategy.ts index 0ef97681d..51d883cea 100644 --- a/src/sdk/strategy/pre-strategy.ts +++ b/src/sdk/strategy/pre-strategy.ts @@ -131,20 +131,20 @@ export class PreStrategy { } public equals(other: PreStrategy) { - return ( - this.cohort.equals(other.cohort) && - // TODO: Replace with `equals` after https://github.com/nucypher/nucypher-core/issues/56 is fixed + return [ + this.cohort.equals(other.cohort), + // TODO: Replace with `equals` after https://github.com/nucypher/rust-umbral/pull/125 is released bytesEquals( this.aliceSecretKey.toBEBytes(), other.aliceSecretKey.toBEBytes() - ) && + ), bytesEquals( this.bobSecretKey.toBEBytes(), other.bobSecretKey.toBEBytes() - ) && - this.startDate.toString() === other.startDate.toString() && - this.endDate.toString() === other.endDate.toString() - ); + ), + this.startDate.toString() === other.startDate.toString(), + this.endDate.toString() === other.endDate.toString(), + ].every(Boolean); } } @@ -203,10 +203,10 @@ export class DeployedPreStrategy { } public equals(other: DeployedPreStrategy) { - return ( - this.cohort.equals(other.cohort) && - this.decrypter.equals(other.decrypter) && - this.policyKey.equals(other.policyKey) - ); + return [ + this.cohort.equals(other.cohort), + this.decrypter.equals(other.decrypter), + this.policyKey.equals(other.policyKey), + ].every(Boolean); } }