Ghost/ghost/security/lib/password.js
Vikas Potluri 59f4570ee7
refactored security.password to use native bcrypt promises (#15126)
refs: https://github.com/TryGhost/Ghost/issues/14882

* refactored security.password to use native bcrypt promises
* refactored security.string to use more modern es features
2022-08-01 16:21:19 +01:00

10 lines
321 B
JavaScript

const bcrypt = require('bcryptjs');
module.exports.hash = async function hash(plainPassword) {
const salt = await bcrypt.genSalt();
return bcrypt.hash(plainPassword, salt);
};
module.exports.compare = function compare(plainPassword, hashedPassword) {
return bcrypt.compare(plainPassword, hashedPassword);
};