creds
v1.0.0
Published
a safe storage for usernames, passwords and group memberhips
Downloads
21
Readme
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