:key: A middleware implementation of fido2 for Express
npm install fido2-middleware
$ npm i fido2-middleware
`Usage
`js
const express = require('express');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const cookieSession = require('cookie-session');
const fido2middleware = require('fido2-middleware');
const crypto = require('crypto');
const app = express();app.use(cookieParser());
app.use(bodyParser.json());
app.use(cookieSession({
name: 'session',
keys: [crypto.randomBytes(32).toString('hex')],
maxAge: 24 60 60 * 1000
}));
app.use(fido2middleware.webAuthentication);
`Configuration
Fido2-middleware reads configuration files in the ./config directory for the running process, typically the application root.
Place the following files in the config directory:
`
{
"fido2-middlewareConfig": {
"fido2lib": {
"timeout": 60000,
"rpId": "localhost",
"challengeSize": 32
},
"origin": "https://localhost:3000",
"factor": "either"
}
}
`Example
`
$ cd example
$ npm install
$ npm start
`
Access to https://localhost:3000/`.Thanks goes to these wonderful people (emoji key):
shiv3 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!