PouchDB TokenStore for Passwordless
npm install passwordless-pouchstoreThis module provides token storage for Passwordless, a node.js module for express that allows website authentication without password using verification through email or other means. Visit the project's website https://passwordless.net for more details.
Tokens are stored in a PouchDB (or CouchDB) database and are hashed and salted using bcrypt.
First, install the module:
$ npm install passwordless-pouchstore --save
Afterwards, follow the guide for Passwordless. A typical implementation may look like this:
``javascript
var passwordless = require('passwordless');
var PouchStore = require('passwordless-pouchstore');
var DB_NAME = 'passwordless-tokens';
passwordless.init(new PouchStore(DB_NAME));
passwordless.addDelivery(
function(tokenToSend, uidToSend, recipient, callback) {
// Send out a token
});
app.use(passwordless.sessionSupport());
app.use(passwordless.acceptToken());
`
`javascript`
new PouchDBStore(dbName);
Example:
`javascript`
var DB_NAME = 'passwordless-db';
passwordless.init(new PouchDBStore(DB_NAME));
$ npm test`