jasstor

0.0.3 • Public • Published

jasstor

Build Status Coverage Status Dependency Status devDependency Status license NPM

Simple file storage for credentials (Node.js module).

Features

  • Stores credentials (user, hashed password) and role name into JSON file
  • Handles verification of given username and password
  • Reads role for given user
  • Passwords are hashed with bcrypt

Installation

npm install jasstor

Getting Started

var Jasstor = require('jasstor');
var jasstor = new Jasstor('credentials.txt');
 
//Encrypt and store password into JSON file
jasstor.saveCredentials('user', 'password', 'role', function(err){
  if (err) {
    //handle error
  }
});
 
//Verify credentials and read user's role
jasstor.verify('user', 'password', function(err, role){
  if (role){
    //user authenticated with role
  } else {
    //user don't exist or wrong password
  }
});
 
//Read role for user
jasstor.getRole('user', function (err, role) {
  if (role){
    //user has role
  } else {
    //user don't exist
  }
});
 

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.

Build

npm install
npm test

License

Copyright (c) 2014 Lubos Krnac. Licensed under the MIT license.

Package Sidebar

Install

npm i jasstor

Weekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • lkrnac