Expand description
多因素认证(MFA)框架
实现基于 TOTP(RFC 6238)的 MFA 验证:
- 生成密钥和 otpauth URI
- 生成当前时间窗口的 6 位 TOTP 码
- 验证用户提交的 TOTP 码(允许 ±1 个时间窗口漂移)
TOTP 算法基于 HOTP(RFC 4226),使用 HMAC-SHA1 和 30 秒时间步长。
Structs§
- MfaManager
- MFA 管理器:管理用户的 MFA 密钥和验证状态
- MfaSecret
- MFA 密钥(Base32 编码的随机字节)
- Totp
Verifier - TOTP 验证器