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

passport-fido2

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-fido2

**THIS IS BETA**

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-26.32%
Maintainers
1
Weekly downloads
 
Created
Source

Passport-FIDO2

THIS IS BETA

Passport strategy for authenticating with FIDO 2.0.

Install

$ npm install passport-fido2

Usage

Configure Strategy

passport.use(new Fido2Strategy({
  readProfile: (id, callback) => {
    fs.readFile(`./keys/${id}.profile`, (err, data) => {
      if(err) return callback(err, null, null);
      try { data = JSON.parse(data); } catch(e) { return callback(e, null, null); }
      callback(null, data.key, data.profile);
    });
  }
},
function(id, profile, done){
  process.nextTick(function(){
    return done(null, profile);
  });
});

Authenticate Requests

app.get('/auth/fido2',
  passport.authenticate('fido2'));

app.get('/auth/line/callback',
  passport.authenticate('fido2', { failureRedirect: '/login', successRedirect: '/' }));

Generate challenge

app.get('/auth/fido2/challenge',
  (req, res) => res.send(Fido2Strategy.challenge('hmac-secret')));

Options

  • passReqToCallback (optional): Pass req object to callback
  • readProfile (required): function(id, callback(err, pubKey, profile)). you need load public key from your storage.

Note

Web service must send these authentication parameters via Query String.

  • id
  • clientData
  • authenticatorData
  • signature

And you may send these params (server generated challenges).

  • c
  • cs

License

The MIT License

FAQs

Package last updated on 20 Dec 2017

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