diff --git a/src/node/util.ts b/src/node/util.ts index a926838e0..a56d6615c 100644 --- a/src/node/util.ts +++ b/src/node/util.ts @@ -157,12 +157,7 @@ export const generatePassword = async (length = 24): Promise => { * Used to hash the password. */ export const hash = async (password: string): Promise => { - try { - return await argon2.hash(password) - } catch (error: any) { - logger.error(error) - return "" - } + return await argon2.hash(password) } /** diff --git a/test/unit/node/util.test.ts b/test/unit/node/util.test.ts index a236bfca6..e5c50b4bd 100644 --- a/test/unit/node/util.test.ts +++ b/test/unit/node/util.test.ts @@ -104,6 +104,10 @@ describe("hash", () => { const hashed = await util.hash(plainTextPassword) expect(hashed).not.toBe(plainTextPassword) }) + it("should return a hash for an empty string", async () => { + const hashed = await util.hash("") + expect(hashed).not.toBe("") + }) }) describe("isHashMatch", () => {