DEV Community

Cover image for Building a Browser 2FA Authenticator With Zero host_permissions, YKOATH NFC, and E2EE Sync
Keyrook
Keyrook

Posted on Originally published at keyrook.com

Building a Browser 2FA Authenticator With Zero host_permissions, YKOATH NFC, and E2EE Sync

Most browser two-factor authentication (2FA) extensions start with a permission request you probably clicked past once and never thought about again:

"host_permissions": ["<all_urls>"]
Enter fullscreen mode Exit fullscreen mode

With <all_urls>, an extension can inject scripts into every tab you visit — banking portals, private internal dashboards, email, cloud consoles — passively observing URLs and DOM contents in the background. Even when the developer is completely honest, granting permanent read access to every webpage just to paste a 6-digit TOTP code once in a while is an unnecessarily wide blast radius.

We built Keyrook Authenticator (free and open source under GPL-3.0) to prove you can get fast 1-click browser 2FA autofill and QR scanning with zero host_permissions in the extension manifest.

1. Zero host_permissions with activeTab-only execution

Instead of injecting content scripts onto every page at load time, Keyrook Authenticator requests no host permissions at all.

It uses Chrome/Edge/Firefox's activeTab permission exclusively in response to an explicit user gesture:

  1. Click Fill (or press the shortcut): The browser grants temporary access to only the currently active tab for that single interaction. We locate the OTP input (including split 6-box React/Vue inputs) and fill the current TOTP/HOTP code.
  2. Click Scan QR: We capture the visible active tab via captureVisibleTab, decode the otpauth:// QR code locally in memory, and never touch any other tab or background URL.

The extension never runs on pages you don't explicitly invoke it on, and never builds a browsing history.

Keyrook Authenticator 1-click active-tab 2FA autofill

2. Encrypted local vault & optional zero-knowledge sync

Every 2FA secret is encrypted locally on your device using AES-256-GCM before touching storage:

  • Device-key or master-password lock: Choose instant unlock with a device key or require a master password + inactivity auto-lock.
  • Screen-share protection: Blur 6-digit codes by default until hovered, so a quick screen share never leaks active tokens.
  • Optional end-to-end encrypted sync: Sync across Chrome, Edge, Firefox, Brave, and Android without trusting the server. Plaintext otpauth:// seeds never leave your device — Keyrook's sync service only sees authenticated ciphertext.

Keyrook Authenticator AES-256-GCM local encryption and lock controls

3. Hardware YubiKey YKOATH NFC on Android

Browser convenience is great, but some high-value accounts (root cloud consoles, domain registrars, GitHub orgs) belong on hardware keys.

The Keyrook Authenticator Android app speaks YKOATH over NFC, letting you tap a YubiKey (or compatible OATH hardware token) directly against the back of your phone to derive codes stored in hardware — alongside your software TOTP/HOTP entries.

4. Zero lock-in: clean import & export

Authenticator apps shouldn't hold your seeds hostage. Keyrook Authenticator supports direct import and export for:

  • Google Authenticator migration QR codes (otpauth-migration://)
  • Aegis and 2FAS exports
  • Standard otpauth:// URI backups and encrypted backups

Try it or audit the source

Everything is free and open source under GPL-3.0:

If you build browser extensions and have run into edge cases with activeTab vs split OTP input frameworks, I'd love to compare notes in the comments!

Top comments (0)