🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

passwordless

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passwordless - npm Package Compare versions

Comparing version

to
1.0.9

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# 1.0.9 (2015-02-14)
Bugfixes:
- N/A
Features:
- N/A
Documentation:
- Better documentation of all callbacks used in Passwordless
- Clarification of Readme.md highlighting that req is passed to the callback
# 1.0.8 (2014-11-26)

@@ -2,0 +14,0 @@

65

lib/passwordless/passwordless.js

@@ -11,3 +11,3 @@ 'use strict';

* other means. It utilizes a very similar mechanism as many sites use for
* resetting passwords. The module was inspired by Justin Balthrop's aritcle
* resetting passwords. The module was inspired by Justin Balthrop's article
* "Passwords are Obsolete"

@@ -87,3 +87,3 @@ * @constructor

* token through requestToken() (default: false)
* @return {function(req, res, next)} Express middleware
* @return {ExpressMiddleware} Express middleware
* @throws {Error} Will throw an error if there is no valid TokenStore, if failureFlash

@@ -193,3 +193,3 @@ * or successFlash is used without flash middleware or allowPost is used without body

* 'origin', default: null)
* @return {function(req, res, next)} Express middleware
* @return {ExpressMiddleware} Express middleware
* @throws {Error} Will throw an error if failureFlash is used without flash middleware,

@@ -252,3 +252,3 @@ * failureFlash is used without failureRedirect, or originField is used without

*
* @return {function(req, res, next)} Express middleware
* @return {ExpressMiddleware} Express middleware
* @throws {Error} Will throw an error if successFlash is used without flash middleware

@@ -295,3 +295,3 @@ */

*
* @return {function(req, res, next)} Express middleware
* @return {ExpressMiddleware} Express middleware
* @throws {Error} Will throw an error no session middleware has been supplied

@@ -312,2 +312,12 @@ */

/**
* @callback getUserID
* @param {Object} user Contact details provided by the user (e.g. email address)
* @param {String} delivery Delivery method used (can be null)
* @param {function(error, user)} callback To be called in the format
* callback(error, user), where error is either null or an error message and user
* is either null if not user has been found or the user ID.
* @param {Object} req Express request object
*/
/**
* Requests a token from Passwordless for a specific user and calls the delivery strategy

@@ -334,8 +344,8 @@ * to send the token to the user. Sends back a 401 error message if the user is not valid

*
* @param {function(user, delivery, callback)} getUserID The function called to resolve
* the supplied user contact information (e.g. email) into a proper user ID. user contains
* the user contact detail provided, delivery the method used (empty if only one method
* has been added to Passwordless), and callback expects a call in the format
* callback(error, user), where error is either null or an error message and user is either
* null if not user has been found or the user ID. req contains the request object
* @param {getUserID} getUserID The function called to resolve the supplied user contact
* information (e.g. email) into a proper user ID: function(user, delivery, callback, req)
* where user contains the contact details provided, delivery the method used, callback
* expects a call in the format callback(error, user), where error is either null or an
* error message and user is either null if not user has been found or the user ID. req
* contains the Express request object
* @param {Object} [options]

@@ -366,3 +376,3 @@ * @param {String} [options.failureRedirect] - If provided, the user will be redirected

* parameters instead of POST (default: false)
* @return {function(req, res, next)} Express middleware
* @return {ExpressMiddleware} Express middleware
* @throws {Error} Will throw an error if failureFlash is used without flash middleware,

@@ -481,2 +491,12 @@ * failureFlash is used without failureRedirect, successFlash is used without flash

/**
* @callback sendToken
* @param {String} tokenToSend The token to send
* @param {Object} uidToSend The UID that has to be part of the token URL
* @param {String} recipient the target such as an email address or a phone number
* depending on the user input
* @param {function(error)} callback Has to be called either with no parameters or
* with callback({String}) in case of any issues during delivery
*/
/**
* Adds a new delivery method to Passwordless used to transmit tokens to the user. This could,

@@ -507,8 +527,8 @@ * for example, be an email client or a sms client. If only one method is used, no name has to

* @param {String} [name] - Name of the strategy. Not needed if only one method is added
* @param {function(tokenToSend, uidToSend, recipient, callback)} sendToken - Method that
* will be called to transmit the token to the user. tokenToSend contains the token,
* uidToSend the UID that has to be part of the token URL, recipient contains the target
* such as an email address or a phone number depending on the user input, and callback
* has to be called either with no parameters or with callback({String}) in case of any
* issues during delivery
* @param {sendToken} sendToken - Method that will be called as
* function(tokenToSend, uidToSend, recipient, callback) to transmit the token to the
* user. tokenToSend contains the token, uidToSend the UID that has to be part of the
* token URL, recipient contains the target such as an email address or a phone number
* depending on the user input, and callback has to be called either with no parameters
* or with callback({String}) in case of any issues during delivery
* @param {Object} [options]

@@ -631,1 +651,10 @@ * @param {Number} [options.ttl] - Duration in ms that the token shall be valid

module.exports = Passwordless;
/**
* Express middleware
* @name ExpressMiddleware
* @function
* @param {Object} req
* @param {Object} res
* @param {Object} next
*/
{
"name": "passwordless",
"version": "1.0.8",
"version": "1.0.9",
"description": "A node.js/express module for passwordless authentication",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -124,3 +124,3 @@ # Passwordless

// Turn the email address into an user's ID
function(user, delivery, callback) {
function(user, delivery, callback, req) {
// usually you would want something like:

@@ -127,0 +127,0 @@ User.find({email: user}, callback(ret) {