feat(auth): email sign-in (link + code) and a factor-class 2FA gate at every sign-in path - #47
Merged
Merged
Conversation
- emailLogin.request / verifyLink / verifyCode / peekLink behind features.emailLogin: one attempt carries a hashed link token and an HMAC'd 6-digit code, consumed once atomically; uniform request response; per email+IP, IP and email rate limits; account created on first verify with a VERIFIED email and a retried generated username. - requiresDeviceStep / runDeviceStep: one 2FA gate for password, email login, magic link and OAuth, with second-step guess limits. - beforeSessionMint hook at every mint site; DEACTIVATED/BANNED refused everywhere, including magic link and passkey. - verifyMagicLink is single-use atomically. - Password reset accepts an app key. - Wildcard-safe case-insensitive lookups (same fix as the 0.20.6 patch).
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.
Minor release for
@factiii/auth(and@factiii/stack).Email sign-in (
features.emailLogin)auth.emailLogin.request/verifyLink/verifyCode/peekLink. One attempt carries a hashed link token and an HMAC'd 6-digit code, consumed once atomically.requestanswers the same for every address; per email+IP, IP and email rate limits; the send never changes the response.appis a key into server config (own keys only); link hosts come only from config.peekLinkreturns a masked address for the confirm screen and spends nothing.appkey.One 2FA gate
requiresDeviceStep/runDeviceStepapply the factor-class rule to password login, email login, magic link and OAuth, with second-step guess limits and the credential spent before any push.hooks.beforeSessionMintruns at every mint site (password, email, magic link, OAuth before linking, passkey). DEACTIVATED and BANNED are refused everywhere.verifyMagicLinkis single-use atomically.Rebased onto 0.20.6; the wildcard-safe lookups from #46 are unchanged in behaviour.
Independently security-reviewed; the findings are fixed in this branch. Tests: 280/280; check-types, lint and build clean.
changeset status: minor for@factiii/authand@factiii/stack.🤖 Generated with Claude Code
https://claude.ai/code/session_01H7frtoCH37E4RjrPC6zLPc