0.2.1 • Published 5 years ago

u2f-demo v0.2.1

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

Universal 2nd Factor NodeJS Demo

Requirements

  • 1 U2F device (e.g. Yubikey)

Quick Start

npm install

Import keystore/server.crt into your keychain. (It's the certificate for HTTPS)

Mark the imported certificate as trusted.

npm start

Then open https://localhost:8001

dev notes

NPMs postinstall script will automatically generate the SSL certificate. But you can also generate the https server credentials manually in ./keystore directory.

openssl req -x509 -out server.crt -keyout server.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

Further reading

For interaction between a yubikey and nodejs directly, see u2f-host-node This is beyond the sope of this demo but nice to read.