-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hashing Data #58
Hashing Data #58
Conversation
+ Function to take some data and hash asynchronously according to field settings in config. + Fields can be given password or hash prop set as true to be told to hash. + New object given back, old not mutated. Related: 52
CI needs fixing but code itself passes on my machine and so can start your review while I fix, will remove WIP when done |
DONE Thanks to kelektiv/node.bcrypt.js#366 |
return cb(null, hashed); | ||
} | ||
|
||
return bcrypt.hash(data[toBeHashed], 10, function (err, hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. so we are hard-coding the bcrypt
hashing "cycles" in the library.
also, how are we going to use this hashed data?
if we attempt to bcrypt.compare
we need to have the plaintext
see: https://github.com/ncb000gt/node.bcrypt.js/#to-check-a-password
Current coverage is 100% (diff: 100%)@@ master #58 diff @@
===================================
Files 10 11 +1
Lines 174 202 +28
Methods 38 46 +8
Messages 0 0
Branches 25 30 +5
===================================
+ Hits 174 202 +28
Misses 0 0
Partials 0 0
|
@jrans what I'm saying is that given that the purpose of this PR is to hash ("sensitive") data and the only situation where we need to
|
@nelsonic Maybe you're missing what I'm proposing but this is function is used on insertion of a new user and password into the database. If the field is meant to be a password it will hash the data if not then it will leave it as is. Yes the only field we need to hash is Two options:
Realise the latter is one more step for the user and we're probably assuming email, password and username necessary for all user data so this could be done by us anyway when applying default requirements on the config. |
@nelsonic ok closing |
THIS PR
Necessary for password, secret answers etc. Function can be used at layer most appropriate
Related: #52