Improved JSDoc for IP Hash Comparison function.

This commit is contained in:
rainbow napkin 2025-11-03 19:11:31 -05:00
parent ade2a4210d
commit 35fd81e1b2

View file

@ -85,6 +85,14 @@ module.exports.hashIP= function(ip, salt){
return `${salt}$${hash}`; return `${salt}$${hash}`;
} }
/**
* Site-wide IP hash comparison function
*
* Allows us to identify new plaintext IP's against saved IP hashes
* @param {String} ip - IP to hash
* @param {String} salt - (optional) string to salt IP with, leave empty to default to a securely generated string encoded in base64
* @returns {Boolean} Whether or not the IP matched the hash
*/
module.exports.compareIPHash = function(ip, hash){ module.exports.compareIPHash = function(ip, hash){
//Split hash by salt delimiter //Split hash by salt delimiter
const splitHash = hash.split("$"); const splitHash = hash.split("$");