mongoose-pass
Another mongoose password hashing module.
Usage
'use strict'; var mongoose = ;var Schema = mongooseSchema; var MySchema = username: type: String required: true index: unique: true ; MySchema; MySchema;
To pass in options:
MySchema;
Note in the example above that it added an authenticate()
method. This method
is an instance method. Once you have a model, you call this method passing in
the tentative password as the first parameter. Now, you can either pass in a
callback as the second parameter, or it returns a promise. See examples of both
above.
Options
passwordPath
(String) - The path to add the password property to. Default:'password'
authMethod
(String) - The name of the instance method that authenticates a user by password. Default'authenticate'
saltWorkFactor
(Number) - The salt work factor used to hash the password. Increasing this number increases the amount of time it takes to hash a password. This is to keep up with Moore's law. Default10