npm

Need private packages and team management tools?Check out npm Orgs. »

non-blocking-bcrypt-nodejs

1.0.4 • Public • Published

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 = require('non-blocking-bcrypt-nodejs')
(async () =>{
    
    try {
        const {salt} = await bcrypt.genSalt()
    
    }
    catch(err){
        
    }
})();
 
 

genHah

  • data - [REQUIRED] - the data to be encrypted.
  • salt - [REQUIRED] - the salt to be used in encryption.
 
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
    
    try {
       const {salt} = await nonBlockingBcrypt.genSalt();
       const {hash} = await nonBlockingBcrypt.genHash(salt, 'sdsasdsafasf');
    
    }
    catch(err){
        
    }
})();
 
 

saltAndHash

  • data - [REQUIRED] - the data to be encrypted.
 
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
    
    try {
       const {hash} = await nonBlockingBcrypt.saltAndHash( 'sdsasdsafasf');
    
    }
    catch(err){
        
    }
})();
 
 

compare

  • data - [REQUIRED] - data to compare.
  • encrypted - [REQUIRED] - data to be compared to.
 
const bcrypt = require('non-blocking-bcrypt-nodejs')
(async () =>{
    
    try {
       const {salt} = await nonBlockingBcrypt.genSalt();
       const {hash} = await nonBlockingBcrypt.genHash(salt, 'sdsasdsafasf');
       const match = await nonBlockingBcrypt.compare('sdsasdsafasf', hash);
 
    }
    catch(err){
        
    }
})();
 
 

Tests

npm test

install

npm i non-blocking-bcrypt-nodejs

Downloadsweekly downloads

4

version

1.0.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability