兼容现有 PBKDF2 密码和 hz_session Cookie TOTP 绑定、二步登录、防重放、恢复码与 AES-GCM 密钥 与 Node 完全一致的 Redis 键格式,可跨运行时共享会话 生产环境开启原生认证时强制要求 Redis 默认保持兼容代理;设置 AUTH_NATIVE_ENABLED=true 即可切换
6 lines
231 B
JavaScript
6 lines
231 B
JavaScript
import { totpAtStep } from '../../src/security/totp.mjs';
|
|
|
|
const secret = String(process.argv[2] || '');
|
|
if (!secret) throw new Error('TOTP secret is required');
|
|
console.log(totpAtStep(secret, Math.floor(Date.now() / 1000 / 30)));
|