A Passwordless TokenStore impleentation using Knex.js
npm install passwordless-knexstore
Create a Knex Table with following properties:
token
string (unique)uid
string (unique)ttl
timestamporigin
string
For example, create a knex migration using this command:
./node_modules/.bin/knex migrate:make passwordless
and add schema creation to the migration:
knex.schema.createTable('passwordless', function(table) {
table.increments('id').primary();
table.string('token').unique();
table.string('uid').unique();
table.timestamp('ttl');
table.string('origin');
});
Initialize store, passing a knex object to it:
var KnexStore = require('passwordless-knexstore');
passwordless.init(new KnexStore(knex));
You can pass a custom table name in the KnexStore options:
passwordless.init(new KnexStore(knex, {table: 'randtokens'}));
Forked from passwordless-bookshelfstore by Niklas Närhinen niklas@narhinen.net.
The MIT license