(password, hash)
| 224 | * @throws {Error} If an argument is illegal |
| 225 | */ |
| 226 | export function compareSync(password, hash) { |
| 227 | if (typeof password !== "string" || typeof hash !== "string") |
| 228 | throw Error("Illegal arguments: " + typeof password + ", " + typeof hash); |
| 229 | if (hash.length !== 60) return false; |
| 230 | return safeStringCompare( |
| 231 | hashSync(password, hash.substring(0, hash.length - 31)), |
| 232 | hash, |
| 233 | ); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Asynchronously tests a password against a hash. |
nothing calls this directly
no test coverage detected