Wednesday 15 November 2017

Handling scrypt callback

Hello,I'm currently working on implementing a passport.js-based implementation of local-authentication in my server.Unfortunately, I'm pretty new to nodejs, so I'm having troubles understanding how to properly implement the scrypt.kdf() function. I only need the result of the function, but if I did it synchronously the program would stop working for at least 3ms while it hashes the string... Which (I think?) is unacceptable.In C# I would probably do it in a new thread. I don't think that's how I should do it in node, but I'm lost with the callback.I have a user object that should be saved in mongodb. I understand how to set the rest of the properties, I'm only lost with the scrypt.kdf() async function.Should I do it with promises?

Submitted November 15, 2017 at 10:55AM by SixLiabilities

No comments:

Post a Comment