creds

a safe storage for usernames, passwords and group memberhips

npm install creds
1 downloads in the last week
4 downloads in the last month

creds

a safe storage for user names, passwords and group memberships

users

Usage:

var creds = require('creds');
var u = creds.users({
    'admin': 'nimda',
    'user': 'resu',
});

console.log('usernames: %j', u.usernames); // => ["admin","user"]
console.log('check password for admin: %s', u('admin', 'nimda')); // => true
console.log('check password for admin: %s', u('admin', 'resu')); // => false

roles

Usage:

var creds = require('creds');
var r = creds.roles({
    'anonymous': [],
    'admin': ['admins'],
    'user': ['users'],
    'admins': ['users'],
    'users': ['registered'],
    'registered': []
});

console.log('roles: %j', r.roles); // => ["anonymous","admin","user","admins","users","registered"]
console.log('roles of user: %j', r.activeRoles('user')); // => ["user","users","registered"]
console.log('check registered membership for admin: %s', r('admin', 'registered')); // => true
console.log('check registered membership for anonymous: %s', r('anonymous', 'registered')); // => false
console.log('check user membership for user: %s', r('user', 'user')); // => true
npm loves you