1.0.1 • Published 7 years ago

bcrypt-promised v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

bcrypt-promised

A promised version of bcrypt.

Installation

Take note that you need also to add bcrypt to your package.json as it linked as peer dependency.

npm i bcrypt-promised bcrypt --save

API

Take note that this module return error (MismatchError) when compare fails.

Check out README of original bcrypt to get meaning of all this.

import bcrypt from 'bcrypt-promised';

bcrypt.genSalt(saltRounds).then(salt => {
  console.log(salt);
});

bcrypt.hash(myPlaintextPassword, saltRounds).then(hash => {
  console.log(hash);
});

bcrypt.compare(plaintextPassword, hash).then(password => {
  console.log(password);
}).catch(err => {
  console.log(err);
});

bcrypt.getRounds(encrypted);