From 0e15f709c4a9b8804a0d4cc99b8fb9d1d5e9fc17 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 13 Mar 2025 10:17:15 +0100 Subject: [PATCH] Remove unnecessary `else if` when checking the encryptionKey in the `CipherTransformFactory` constructor This can be simplified a tiny bit since we already throw `PasswordException` when no password is provided. --- src/core/crypto.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/crypto.js b/src/core/crypto.js index e11f579e0..a6cc5e8bf 100644 --- a/src/core/crypto.js +++ b/src/core/crypto.js @@ -1125,12 +1125,13 @@ class CipherTransformFactory { perms ); } - if (!encryptionKey && !password) { - throw new PasswordException( - "No password given", - PasswordResponses.NEED_PASSWORD - ); - } else if (!encryptionKey && password) { + if (!encryptionKey) { + if (!password) { + throw new PasswordException( + "No password given", + PasswordResponses.NEED_PASSWORD + ); + } // Attempting use the password as an owner password const decodedPassword = this.#decodeUserPassword( passwordBytes,