I\'m currently trying to make authentication module for my project in node.js?
I\'ve already seen some examples of using bcrypt to generate hashes, i.e.
http
Yes, you'd want to use the async version if possible so you're not tying up your node processing during the password hash. In both source code cases you reference, the code is using the synchronous version because the method it's used within is synchronous so the author had no choice but to use the synchronous version.
You can't make an async call inside of a synchronous method. Try making a separate method to use when setting the password.
I just submitted a pull request so someone's project that does exactly this. Check it out here: https://github.com/nickpoorman/CrowdNotes/commit/e268c80a9cacddbc0215bf0e2b7aa31c0a4c785f