Added JSDoc to ESLint (#3529)

* Added JSDoc to eslint rules

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>

* Fixed JSDoc eslint errors

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>

* Update the check-linters workflow to Node.js 20

---------

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
Matthew Nickson
2023-08-11 09:46:41 +02:00
committed by GitHub
parent da4f4e3d76
commit 8a92054c2b
153 changed files with 1505 additions and 574 deletions

View File

@@ -4,8 +4,8 @@ const saltRounds = 10;
/**
* Hash a password
* @param {string} password
* @returns {string}
* @param {string} password Password to hash
* @returns {string} Hash
*/
exports.generate = function (password) {
return bcrypt.hashSync(password, saltRounds);
@@ -13,8 +13,8 @@ exports.generate = function (password) {
/**
* Verify a password against a hash
* @param {string} password
* @param {string} hash
* @param {string} password Password to verify
* @param {string} hash Hash to verify against
* @returns {boolean} Does the password match the hash?
*/
exports.verify = function (password, hash) {
@@ -27,8 +27,8 @@ exports.verify = function (password, hash) {
/**
* Is the hash a SHA1 hash
* @param {string} hash
* @returns {boolean}
* @param {string} hash Hash to check
* @returns {boolean} Is SHA1 hash?
*/
function isSHA1(hash) {
return (typeof hash === "string" && hash.startsWith("sha1"));
@@ -36,7 +36,8 @@ function isSHA1(hash) {
/**
* Does the hash need to be rehashed?
* @returns {boolean}
* @param {string} hash Hash to check
* @returns {boolean} Needs to be rehashed?
*/
exports.needRehash = function (hash) {
return isSHA1(hash);