Skip to content

Latest commit

 

History

History
executable file
·
28 lines (22 loc) · 928 Bytes

auth-doc.md

File metadata and controls

executable file
·
28 lines (22 loc) · 928 Bytes

modules/auth

authorization module.

Requires: module:bcrypt

modules/auth~auth(db, name, pass) ⇒ Promise.<Boolean>

authorize

Kind: inner method of modules/auth
Returns: Promise.<Boolean> - promise to a boolean. true: authorized, false: not authorized

Param Type Description
db Object mongodb connection object
name String the name of the stream / user
pass String the streams auth key / password

Example (Example usage of auth function.)

var auth = require('modules/auth/auth');
auth(mongoDB-connection, 'registeredUser', 'supersecurepassword').then(authorized => {
  if (!authorized) return 'fail';
  return 'allowed';
})