What problem does it solve? Implementing multi-factor authentication from scratch is error-prone and security-critical. This Skill provides complete, working patterns for adding two-factor authentication to applications using Better Auth's twoFactor plugin, covering TOTP authenticator apps, email/SMS OTP, backup codes, and trusted devices. ## Core Features & Use Cases - TOTP Authenticator Setup: Enable 2FA with QR code generation, configurable digits and period, and code verification with time-window tolerance. - OTP via Email/SMS: Send one-time codes with configurable validity period, attempt limits, and encrypted or hashed storage. - Backup Codes & Recovery: Generate, regenerate, and verify single-use backup codes with encrypted storage options. - Sign-In Flow Handling: Detect twoFactorRedirect responses, manage temporary 2FA cookies, and support trusted devices with 30-day trust duration. - Use Case: A developer adding MFA to a Better Auth application can follow the complete configuration example to set up TOTP, OTP delivery via their email service, backup codes, and rate limiting in one pass. ## Quick Start Ask the AI to add two-factor authentication with TOTP and email OTP to your Better Auth configuration using the twoFactor plugin.