From 904bd7b84895b1991edff49c5cb123667ec28b07 Mon Sep 17 00:00:00 2001 From: md-ajju <108057436+md-ajju@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:57:53 +0530 Subject: [PATCH] Handling password is undefined or null cases using Handling password is undefined or null cases using --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b96689a..62ba14a 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ module.exports = function (password, saltBytes) { saltBytes: saltBytes || 32, }; - if (password.length < 43) throw new Error('Please use base64 password with at least 43 characters. Google password "password generator" and don\'t be lazy.'); + if (!Boolean(password) || password.length < 43) throw new Error('Please use base64 password with at least 43 characters. Google password "password generator" and don\'t be lazy.'); /** * Encrypt a Javascript object.