non-blocking-bcrypt-nodejs
warper for bcrypt-nodejs that works on a sub process to keep the crypto actions from starving the event loop.
Limitations
works on NodeJS version 7.6+,
Installing
npm install non-blocking-bcrypt-nodejs --save
lets jump to some examples
Examples
genSalt
rounds
- [OPTIONAL] - the number of rounds to process the data for. (default - 10)
const bcrypt = async { try const salt = await bcrypt catcherr };
genHah
data
- [REQUIRED] - the data to be encrypted.salt
- [REQUIRED] - the salt to be used in encryption.
const bcrypt = async { try const salt = await nonBlockingBcrypt; const hash = await nonBlockingBcrypt; catcherr };
saltAndHash
data
- [REQUIRED] - the data to be encrypted.
const bcrypt = async { try const hash = await nonBlockingBcrypt; catcherr };
compare
data
- [REQUIRED] - data to compare.encrypted
- [REQUIRED] - data to be compared to.
const bcrypt = async { try const salt = await nonBlockingBcrypt; const hash = await nonBlockingBcrypt; const match = await nonBlockingBcrypt; catcherr };
Tests
npm test