I try to convert the form input password value using bcrypt. First I installed bcrypt (npm install bcrypt --save) after I added like this
var bcrypt = require('bcrypt');
var hash = bcrypt.hashSync(values.newPassword, 10);
Then in the cmd display so mush errors like this
ERROR in ./node_modules/forever-agent/index.js Module not found: Error: Can't resolve 'tls' in
Can you help me? Thank you
So the normal bcrypt isn't like a typical library. It's written in c++ and compiled for your machine when you npm install
it. It does not work in the browser because of that (and more). However, there is a pure javascript implementation that IS browser compatible (and portable in general):
bcryptjs
npm install bcryptjs
Do read their browser implementation to guide through setup. They have a few small things needing to be done to generate the cryptographically safe random numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With