ToolypetMCP
intermediate3 minutessecurity

Two-Factor Authentication Setup

Implement TOTP-based 2FA with secret generation, QR code URI, and backup codes.

2fatotpauthenticationsecurity

이 레시피 활용 시점

Add an extra security layer to your application. TOTP-based 2FA is used by Google Authenticator, Authy, and other apps. Backup codes ensure users aren't locked out.

단계

1

Create the TOTP secret and QR URI

프롬프트:Generate a TOTP secret for user@example.com with issuer 'MyApp', 6 digits, 30 second period
2

Create recovery backup codes

프롬프트:Generate 10 backup codes (8 characters each, alphanumeric)
3

Hash backup codes before storing

프롬프트:Hash the backup codes with SHA-256 for secure storage

자주 묻는 질문

TOTP vs SMS for 2FA — which is better?

TOTP is significantly more secure. SMS is vulnerable to SIM swapping and interception attacks. NIST recommends against SMS-based 2FA for sensitive applications.

How should I store TOTP secrets?

Encrypt TOTP secrets at rest using AES-256. They must be recoverable (unlike passwords which are hashed one-way) because the server needs the secret to verify codes.

관련 레시피