Video 103: Securely Storing Password: Part 1
This commit is contained in:
parent
0be39f69ef
commit
015ea3619f
5
task-manager/package-lock.json
generated
5
task-manager/package-lock.json
generated
@ -180,6 +180,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"bcryptjs": {
|
||||||
|
"version": "2.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
|
||||||
|
"integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms="
|
||||||
|
},
|
||||||
"binary-extensions": {
|
"binary-extensions": {
|
||||||
"version": "1.13.1",
|
"version": "1.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"bcryptjs": "^2.4.3",
|
||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"mongodb": "^3.1.10",
|
"mongodb": "^3.1.10",
|
||||||
"mongoose": "^5.3.16",
|
"mongoose": "^5.3.16",
|
||||||
|
@ -13,3 +13,18 @@ app.use(taskRouter)
|
|||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log('Server is up on port ' + port)
|
console.log('Server is up on port ' + port)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const bcrypt = require('bcryptjs')
|
||||||
|
|
||||||
|
const myFunction = async () => {
|
||||||
|
const password = 'Red12345!'
|
||||||
|
const hashedPassword = await bcrypt.hash(password, 8)
|
||||||
|
|
||||||
|
console.log(password)
|
||||||
|
console.log(hashedPassword)
|
||||||
|
|
||||||
|
const isMatch = await bcrypt.compare('red12345!', hashedPassword)
|
||||||
|
console.log(isMatch)
|
||||||
|
}
|
||||||
|
|
||||||
|
myFunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user