Spaces:
Runtime error
Runtime error
Commit
·
ad62c47
1
Parent(s):
535594d
add util function to hash a password
Browse files
src/utils/passwordUtils.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import bcrypt from 'bcryptjs';
|
| 2 |
+
|
| 3 |
+
export const hashPassword = async (password: string) => {
|
| 4 |
+
const salt = await bcrypt.genSalt(10);
|
| 5 |
+
const hashedPassword = await bcrypt.hash(password, salt);
|
| 6 |
+
return hashedPassword;
|
| 7 |
+
}
|