Repository navigation
Vault: auto-link 2FA codes to their logins - #245
Merged
Merged
Conversation
A login without linked 2FA now gets the most likely free 2FA entry (fuzzy brand + account match, known aliases). vault_fill_totp types it on the login's own site, watches the page and links the pair once the site takes the code; a rejected guess moves on to the next candidate. The 2FA page offers clear matches for one-click linking, and missing-2FA suggestions use the same matcher.
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Logins and 2FA codes now find each other by themselves.
vault_fill_totpfor a login that has no 2FA linked, Godmode picks the free 2FA entry that most likely belongs to it, types its code on the login's own site and watches the page. Once the site takes the code (the code field is gone on two looks in a row, no error text, still on the login's site), the pair is linked for good. If the site rejects it, the next call tries the next likely entry. Nothing is linked on a guess alone.vault/totpGuess.ts): issuer vs. login name, URL and domains (exact, prefix/contains, Levenshtein, aliases such as X/Twitter, AWS/Amazon Web Services, Google/Gmail), account name vs. username (full, local part). The site has to match; a shared email alone never counts. A short brand inside a much longer one (Meta vs. Metabase) is only a weak guess.GET/POST /api/totp/autolink.Safety
linkCredentialTotpIfFreenever replaces an existing link on either side.totp.autolink).Screenshots
2FA page with suggestions, and after linking (cards show their logins live):
See
2fa-autolink-panel.pngand2fa-after-link.png(attached in the conversation).Tests
test/totp-guess.test.ts: scoring, ranking, one-to-one suggestions, page watcher (accepted / rejected / off-site / superseded / timeout).test/mcp.test.ts: end to end throughvault_fill_totp— the right code gets linked after the site accepts it; rejected guesses move on and are never linked.