Self-hosted TOTP authenticator PWA with FIDO2 (WebAuthn)
Go to file
soruly 48f7f451d8
Add FIDO2 web authn
2022-06-18 12:16:02 +00:00
.github Init 2022-06-16 08:28:12 +00:00
src Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
static Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
view Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
.env.example Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
.gitignore Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
.prettierrc.json Init 2022-06-16 08:28:12 +00:00
CODE_OF_CONDUCT.md Init 2022-06-16 08:28:12 +00:00
LICENSE Init 2022-06-16 08:28:12 +00:00
README.md Update README.md 2022-06-16 08:44:20 +00:00
ecosystem.config.json Init 2022-06-16 08:28:12 +00:00
package-lock.json Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
package.json Add FIDO2 web authn 2022-06-18 12:16:02 +00:00
server.js Add FIDO2 web authn 2022-06-18 12:16:02 +00:00

README.md

2FA

License GitHub Workflow Status

Self hosted 2-factor authenticator PWA

Features

  • 2FA authenticator hosted on web
  • Allow others to access the OTP of your accounts
  • Installable PWA
  • (TBC) Display timeout indicator
  • (TBC) Scan QR Code instead of manual input
  • (TBC) Show QR Code for copying to other devices

Warning

It is dangerous to host 2FA authenticators on cloud. This PWA is not secured by any password. Everyone is able to access your OTP. The author does not bear any losses caused by this app.

Getting Started

Prerequisites: nodejs >= 16

git clone https://github.com/soruly/2fa.git
cd 2fa
npm install
node server.js

Note: In order for PWA to work, you must host the server behind a reverse proxy (like nginx) with HTTPS

Example nginx config:

location / {
  proxy_set_header Host $host;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection upgrade;
  proxy_buffering off;
  proxy_cache off;
  proxy_pass http://127.0.0.1:3000;
}

Environment Variables

  • Copy .env.example to .env
  • Edit .env as you need
SERVER_PORT # (optional) Default: 3000
SERVER_ADDR # (optional) Default: 127.0.0.1

Run by pm2

You also can use pm2 to run this in background.

Use below commands to start / restart / stop server.

npm run start
npm run stop
npm run reload
npm run restart
npm run delete