New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-password-storage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-password-storage

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

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Node Password Storage

Generated by OSS Project Generator.

Travis Status AppVeyor Status CircleCI Status Coveralls Status NPM Version License

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

Installation

Prerequsites

  • Install Node.js
  • Install npm

Install package:

$ npm install --save node-password-storage

Usage

  • Generate a salt
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
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
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
$ git clone https://github.com/robertoachar/node-password-storage.git
  • Install dependencies
$ npm install
ActionUsage
Starting development modenpm start
Linting codenpm run lint
Running unit testsnpm run jest
Running code coveragenpm run coverage
Running lint + testsnpm test
Sending coverage results to Coveralls.ionpm run coveralls

Author

Roberto Achar

License

MIT

Keywords

node

FAQs

Package last updated on 15 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts