Skip to content

🔑 Module that handles the creation and verification of ephemeral password reset and account activation tokens.

License

Notifications You must be signed in to change notification settings

bookercodes/memento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memento is a module that handles the creation and verification of ephemeral tokens. It is really useful for password reset and email activation features.

##Installation

Memento is available on npm:

npm install --save booker-memento

##Example

var Memento = require("booker-memento");

var memento = new Memento("secret");

var user = {
  email: "[email protected]",
  hash: "C6XbuRC.{5}WztufMP<u*^>c8_k~"
};

var passwordResetToken = memento.createToken(user);

passwordResetToken; // 1436012310:8c54cee7bef71a272a6116c5b11fa06362e5d7a7

var valid = memento.verifyToken(user);

valid; // true

user.salt = "123";

var valid = memento.verifyToken(user, passwordResetToken);

valid; // false

About

🔑 Module that handles the creation and verification of ephemeral password reset and account activation tokens.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published