This repository was archived by the owner on Aug 7, 2023. It is now read-only.
Repository navigation
|
I have created the Deta DB but i want to store the users password hash and while when user login then hash password should be compare with plan password i don't know how i could achieve this |
Answered by
Sokhavuth
Sep 8, 2022
Replies: 2 comments 4 replies
|
1 reply
|
You could use bcrypt that is independent from any kind of database. Here is an example of using bcrypt in Node.js: // npm install bcryptjs
const bcrypt = require("bcryptjs")
// to hash a password
const hashedPassword = bcrypt.hashSync("password", 8)const bcrypt = require("bcryptjs")
// to verify password
if(bcrypt.compareSync(req.body.password, user.hashedPassword)){
...
}else{
...
}Here is my website on Deta in which bcrypt is being used to hash and verify password: https://khmerweb.deta.dev/ |
3 replies
Answer selected by
amir7896
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use bcrypt that is independent from any kind of database. Here is an example of using bcrypt in Node.js:
Here is my website on Deta in which bcrypt is being used to hash and verify password: https://khmerweb.deta.dev/