* refactor: use fastify vite for the server by doing this we do not need to have local hacks for the routes. No local proxy needed. Everything just works. * fix: update the dockerfile build path * fix: update package.json * fix: fonts path
24 lines
570 B
JavaScript
24 lines
570 B
JavaScript
import bcrypt from 'bcryptjs';
|
|
|
|
// https://www.npmjs.com/package/bcrypt
|
|
export async function hash(password) {
|
|
try {
|
|
// salt rounds https://www.npmjs.com/package/bcrypt#user-content-a-note-on-rounds
|
|
return await bcrypt.hash(password, 10);
|
|
} catch (error) {
|
|
console.error(error);
|
|
|
|
throw new Error('Error hashing the password');
|
|
}
|
|
}
|
|
|
|
export async function compare(password, hash) {
|
|
try {
|
|
return await bcrypt.compare(password, hash);
|
|
} catch (error) {
|
|
console.error(error);
|
|
|
|
return false;
|
|
}
|
|
}
|