mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
59f4570ee7
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
10 lines
321 B
JavaScript
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);
|
|
};
|