Skip to content

trustmaster/passwordless-knexstore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

passwordless-knexstore

A Passwordless TokenStore impleentation using Knex.js

Installation

npm install passwordless-knexstore

Usage

Create a Knex Table with following properties:

  • token string (unique)
  • uid string (unique)
  • ttl timestamp
  • origin 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'}));

Author

Forked from passwordless-bookshelfstore by Niklas Närhinen niklas@narhinen.net.

License

The MIT license

About

Passwordless token store using knex.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%