13 lines
228 B
JavaScript
13 lines
228 B
JavaScript
import bcrypt from 'bcrypt';
|
|
|
|
const SALT_ROUNDS = 10;
|
|
|
|
function hash(text) {
|
|
return bcrypt.hash(text, SALT_ROUNDS);
|
|
}
|
|
|
|
function compare(text, hash) {
|
|
return bcrypt.compare(text, hash);
|
|
}
|
|
|
|
export default { hash, compare } |