Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aichholzer/promised-bcrypt

Promised bcrypt goodness.
https://github.com/aichholzer/promised-bcrypt

Last synced: 25 days ago
JSON representation

Promised bcrypt goodness.

Awesome Lists containing this project

README

        

# promised-bcrypt

[![Greenkeeper badge](https://badges.greenkeeper.io/aichholzer/promised-bcrypt.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/aichholzer/promised-bcrypt.svg?branch=master)](https://travis-ci.org/aichholzer/promised-bcrypt)
[![Downloads](https://img.shields.io/npm/dt/promised-bcrypt.svg)](https://www.npmjs.com/package/promised-bcrypt)
[![Always useful](https://img.shields.io/badge/always-useful-ff6400.svg)](https://github.com/aichholzer/promised-bcrypt)

Promised bcrypt goodness.
git rebase
##### 🔥 This module has been deprecated since the introduction of `bcrypt v1.0.0`.

### Install
```
npm install --save promised-bcrypt
```

### API
- `.hash(string, rounds)` - {rounds} defaults to `10`.
- `.compare(string, hash)`
- `.genSalt(rounds)` - {rounds} defaults to `10`.
- `.getRounds(hash)`

All of these return a `Promise`.

### Use
```
const bcrypt = require('promised-bcrypt');
bcrypt.hash('Hello')
.then(hash => {
console.log(hash);
});

// '$2a$10$LriA/LnuQRIh63uyGU8t6TFwp)9y^wnLd3fw0duLnhe0SN.vS.Pka'
```

```
const bcrypt = require('promised-bcrypt');
bcrypt.compare('Hello', hash)
.then(pass => {
console.log(pass);
});

// true
```

```
const bcrypt = require('promised-bcrypt');
bcrypt.getRounds(hash)
.then(rounds => {
console.log(rounds);
});

// 10
```

### Contribute
```
fork https://github.com/aichholzer/promised-bcrypt
```

### Further reading

[https://github.com/kelektiv/node.bcrypt.js](https://github.com/kelektiv/node.bcrypt.js)

### License

[MIT](https://github.com/aichholzer/promised-bcrypt/blob/master/LICENSE)