A time-based one-time password (TOTP) generator implementation in JavaScript.
This project is a modified version of russau's TOTP One-time password JSFiddle which fully works in the browser. It uses QRious for QR code encoding and jsSHA for SHA-1 generation (sha1.js v3.3.1).
See it live: https://xyr11.github.io/totp-generator/
You can also download the latest release and open index.html
.
You can add query strings to automatically fill in the fields. They are based on the OTP Key URI format. The fields are:
Query field | Description | Example value |
---|---|---|
label | String used to identify the account a key is associated with | GitHub: email@site.com |
secret | Arbitrary key value encoded in Base32 | ABCDE |
issuer | (Optional) The provider or service the key is associated with | GitHub |
It also accepts QRious options (except element
and value
) to customize the QR code:
Query field | Description | Default value |
---|---|---|
background | Background color of the QR code | white |
backgroundAlpha | Background alpha of the QR code | 1.0 |
foreground | Foreground color of the QR code | black |
foregroundAlpha | Foreground alpha of the QR code | 1.0 |
level | Error correction level of the QR code (L, M, Q, H) | L |
mime | MIME type used to render the image for the QR code | image/png |
padding | Padding for the QR code (pixels) | None (auto) |
size | Size of the QR code (pixels) | 200 |
This project is licensed under the MIT License. The original code from JSFiddle doesn't have a license. QRious is licensed under the GPL v3 License and jsSHA is licensed under the 3-Clause BSD license.