const bcrypt = require('bcryptjs'); /** * 密码哈希 */ const hashPassword = async (password) => { return await bcrypt.hash(password, 10); }; /** * 密码比对 */ const comparePassword = async (password, hash) => { return await bcrypt.compare(password, hash); }; module.exports = { hashPassword, comparePassword };