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

passwordless-cache-manager

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passwordless-cache-manager

Use node-cache-manager as a passwordless token store

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

passwordless-cache-manager

A token store for Passwordless, a node.js module for express that allows website authentication without password using verification through email or other means.

This store implementation uses node-cache-manager, which supports multiple storage engines.

Tokens are stored in memory and are hashed and salted using bcryptjs.

Acknowledgements

Most of the project scaffolding is lifted from passwordless-memorystore, with modifications specific to using node-cache-manager.

Usage

First, install the module:

$ npm install cache-manager passwordless-cache-manager --save

Afterwards, follow the guide for Passwordless. A typical implementation may look like this:

var passwordless = require('passwordless');

var cacheManager = require('cache-manager');
var CacheManagerStore = require('passwordless-cache-manager');

// Using the built-in memory store as an example. Swap this out with the specific cache-manager storage engine you need
var memoryStore = require('cache-manager/lib/stores/memory');

passwordless.init(new CacheManagerStore(cacheManager.caching({
  store: memoryStore
})));

passwordless.addDelivery(
    function(tokenToSend, uidToSend, recipient, callback) {
        // Send out a token
    });
    
app.use(passwordless.sessionSupport());
app.use(passwordless.acceptToken());

Initialization

var cacheManager = require('cache-manager');
var CacheManagerStore = require('passwordless-cache-manager');

new CacheManagerStore(cacheManager.caching({
    store: <cache-manager store>,
    // store-related options
}));

Hash and salt

As the tokens are equivalent to passwords (even though they do have the security advantage of only being valid for a limited time) they have to be protected in the same way. passwordless-cache-manager uses bcryptjs with automatically created random salts. To generate the salt 10 rounds are used.

Tests

$ npm test

License

MIT License

Keywords

FAQs

Package last updated on 14 Jul 2016

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