# node-password-storage

> The best way to protect passwords is to employ salted password hashing.

Latest version **1.0.4** (published 2018-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-password-storage
pnpm add node-password-storage
yarn add node-password-storage
bun add node-password-storage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-01-15 |
| First published | 2017-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Roberto Achar |
| Maintainers | robertoachar |
| Keywords | node, salt, password, hash |

## Links

- npm: https://www.npmjs.com/package/node-password-storage
- Repository: https://github.com/robertoachar/node-password-storage
- Homepage: https://github.com/robertoachar/node-password-storage#readme
- Issues: https://github.com/robertoachar/node-password-storage/issues
- npm.io page: https://npm.io/package/node-password-storage

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-01-15
- 1.0.3 — 2017-10-29
- 1.0.2 — 2017-05-30
- 1.0.1 — 2017-05-22
- 1.0.0 — 2017-05-17

## README

# Node Password Storage

Generated by [OSS Project Generator](http://bit.ly/generator-oss-project).

[![Travis Status][travis-badge]][travis-url]
[![AppVeyor Status][appveyor-badge]][appveyor-url]
[![CircleCI Status][circleci-badge]][circleci-url]
[![Coveralls Status][coveralls-badge]][coveralls-url]
[![NPM Version][npm-badge]][npm-url]
[![License][license-badge]][license-url]

> The best way to protect passwords is to employ salted password hashing.

# Installation

## Prerequsites

* Install [Node.js](https://nodejs.org)
* Install [npm](https://www.npmjs.com/)

Install package:

```bash
$ npm install --save node-password-storage
```

# Usage

* Generate a salt

```javascript
const lib = require('node-password-storage');

const salt_size = 32;

lib.generateSalt(salt_size, (err, salt) => {
  if (err) return console.error(err);

  console.log(`SALT: ${salt.toString('hex')}\n`);
});
```

* Generate a hash

```javascript
const lib = require('node-password-storage');

const password = 'password';
const salt = 'salt';

lib.generateHash(password, salt, (err, hash) => {
  if (err) return console.error(err);

  console.log(`HASH: ${hash.toString('hex')}\n`);
});
```

* To generate and compare a storage

```javascript
const lib = require('node-password-storage');

const password = 'password';

lib.generateStorage(password, (err, storage) => {
  if (err) return console.error(err.message);

  const params = storage.split(':');
  console.log(`SALT => ${params[0]}`);
  console.log(`HASH => ${params[1]}`);

  lib.verifyStorage(password, storage, (err, success) => {
    if (err) return console.error(err);

    console.log(`MATCH: ${success}`);
  });
});
```

# Development

* Clone the repo

```bash
$ git clone https://github.com/robertoachar/node-password-storage.git
```

* Install dependencies

```bash
$ npm install
```

| Action                                   | Usage               |
| ---------------------------------------- | ------------------- |
| Starting development mode                | `npm start`         |
| Linting code                             | `npm run lint`      |
| Running unit tests                       | `npm run jest`      |
| Running code coverage                    | `npm run coverage`  |
| Running lint + tests                     | `npm test`          |
| Sending coverage results to Coveralls.io | `npm run coveralls` |

# Author

[Roberto Achar](https://twitter.com/RobertoAchar)

# License

[MIT](https://github.com/robertoachar/node-password-storage/blob/master/LICENSE)

[travis-badge]: https://travis-ci.org/robertoachar/node-password-storage.svg?branch=master
[travis-url]: https://travis-ci.org/robertoachar/node-password-storage
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/github/robertoachar/node-password-storage?branch=master&svg=true
[appveyor-url]: https://ci.appveyor.com/project/robertoachar/node-password-storage
[circleci-badge]: https://circleci.com/gh/robertoachar/node-password-storage/tree/master.svg?style=shield
[circleci-url]: https://circleci.com/gh/robertoachar/node-password-storage
[coveralls-badge]: https://coveralls.io/repos/github/robertoachar/node-password-storage/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/robertoachar/node-password-storage?branch=master
[npm-badge]: https://img.shields.io/npm/v/node-password-storage.svg
[npm-url]: https://www.npmjs.com/package/node-password-storage
[license-badge]: https://img.shields.io/github/license/robertoachar/node-password-storage.svg
[license-url]: https://opensource.org/licenses/MIT

---
_Source: https://npm.io/package/node-password-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
