Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-password-reset-token

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-password-reset-token

Generate and validate password reset tokens

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cf-password-reset-token

Generate and validate password reset tokens

Installation

npm install --save cf-password-reset-token

Usage

var passwordResetToken = require('cf-password-reset-token')

// Generate a token for an authable entity (i.e one that can authorize
// themself with the system – e.g. administrator, user, customer)
passwordResetToken.generate(authableEntity)
//-> { token: '...', expiry: '...'}

// Check that a password reset token is valid for a given authable entity
passwordResetToken.validate(authableEntity, token)
//-> true or false

API

var t = require('cf-password-reset-token')

t.generate(Object: authableEntity, Object: options)

authableEntity must have the following properties: created and password, along with an identity property that be configured with options.identityProperty. This defaults to 'emailAddress'. options.expiry can be used to configure how long the token is valid for. The default is 1 hour.

t.validate(Object: authableEntity, Object: token)

authableEntity is the entity that token should be validated against. This function will return true if both of the following conditions are met:

  • token.token is a valid token
  • token.expiry is not in the past
  • Certain properties of authableEntity are the same as when the token was created: created, password and its identityProperty

Credits

Built by developers at Clock.

Licence

Licensed under the New BSD License

FAQs

Package last updated on 08 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc