@dokebi/two-factor
v0.2.3
Published
Two-factor sign-in for @dokebi/auth: TOTP codes of authenticator apps (secrets encrypted at rest), recovery codes stored as HMACs, or a code sent by mail, a second step after the password, remembered devices, lockout, and a code confirmation for re-authen
Maintainers
Readme
@dokebi/two-factor
Two-factor sign-in for @dokebi/auth on PostgreSQL, MySQL 8 and MariaDB 10.6+ through @dokebi/db. Version 0.2.0. AI agents start with AI.md; the design is D-0174.
twoFactor.attempt(request, reply, credentials)checks the password and answerssecond-factorfor users who turned it on;verify(request, reply, { code })signs them in with a code of their authenticator app (TOTP) or a recovery code.- Setup:
begin(anotpauth://URI for the QR code),enablewith the first code (ten recovery codes, shown once),disableandregenerateCodesafter a fresh password and code confirmation. - A code by mail for users without an authenticator app (
mail: {},mailCodes(resolver),resend,sendConfirmation; through @dokebi/mail and @dokebi/job): wrong codes end the sign-in and lock nothing, mails are limited per account. - Secrets encrypted at rest, recovery codes stored as HMACs, a code good once, lockout after wrong codes, remembered devices,
confirmfor the re-authentication page.
MIT licensed.
