This is a simple Node.js script to generate Time-based One-Time Passwords (TOTP) based on a shared secret. It supports customizable time steps and OTP digit lengths.
./gentotp --secret <SECRET> [--time-step <STEP>] [--digits <DIGITS>]
# or
./gentotp -s <SECRET> [-t <STEP>] [-d <DIGITS>]--secret,-s: The TOTP secret (required).--time-step,-t: The time step in seconds (default is 30 seconds).--digits,-d: The number of digits in the OTP (default is 6 digits).
$ ./gentotp --secret JBSWY3DPEHPK3PXP
$ ./gentotp -s JBSWY3DPEHPK3PXP -t 30 -d 6
492039To extract the secret from a QR code image, you can use online tools such as:
- google otp decoder (repository)
This project references decodeGoogleOTP
See 从Google Authenticator解密获取2FA密钥备份教程 - 知乎