Observed since 20 Oct, 19:12 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Lightweight utility to generate a two-factor TOTP secret with QR code to be used by authenticators such as Google or Microsoft Authenticator.
A lightweight, robust Node.js utility for generating Two-Factor Authentication (TOTP) secrets, QR codes, and verifying tokens. Compatible with Google Authenticator, Microsoft Authenticator, and Authy.
otplib options.otplib and qrcode under the hood).npm install 2fa-util
const { generateSecret, verify } = require('2fa-util');
(async () => {
// 1. Generate a Secret and QR Code
const { secret, qrcode, otpauth } = await generateSecret('john.doe@example.com', 'MyApp');
console.log('Secret:', secret);
console.log('QR Code Data URL:', qrcode); // Display this in an <img src="...">
// ... User scans QR code ...
// 2. Verify a Token
const userToken = '123456'; // Input from user
const isValid = verify(userToken, secret);
console.log('Is Valid:', isValid);
})();
You can pass standard otplib options to the verify function, such as window (for clock drift) or step.
const isValid = verify(token, secret, {
window: 1, // Allow 1 step before/after (approx +/- 30sec)
step: 60 // Custom step size in seconds
});
generateSecret(label, [issuer])Generates a new TOTP secret and corresponding QR code.
(string): The username or account identifier (e.g., email).(string, optional): The name of your application or company.Promise<Object>
secret: The base32 encoded secret key.qrcode: A Data URI string (base64) of the QR code image.otpauth: The raw otpauth:// URL.verify(token, secret, [options])Verifies a TOTP token against a secret.
(string): The 6-digit token provided by the user.(string): The user's stored secret key.(Object, optional): Configuration object passed to otplib.boolean (true if valid, false otherwise).generate(secret)Generates the current token for a given secret (useful for testing or dev tools).
(string): The secret key.string (The current 6-digit token).Clone the repository and install dependencies:
git clone https://github.com/jzhobes/2fa-util.git
cd 2fa-util
npm install
Run tests:
npm test
Run linting:
npm run lint
MIT © John Ho
npm · 90 observations shown. Missing days are unknown.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-21 – 2026-10-21 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-20 – 2026-10-20 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-19 – 2026-10-19 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-18 – 2026-10-18 | 259 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-17 – 2026-10-17 | 16 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-16 – 2026-10-16 | 432 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-15 – 2026-10-15 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-14 – 2026-10-14 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-13 – 2026-10-13 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-12 – 2026-10-12 | 191 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-11 – 2026-10-11 | 87 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-10 – 2026-10-10 | 55 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-09 – 2026-10-09 | 763 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-08 – 2026-10-08 | 1,137 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-07 – 2026-10-07 | 958 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-06 – 2026-10-06 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-05 – 2026-10-05 | 839 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-04 – 2026-10-04 | 45 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-03 – 2026-10-03 | 86 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-02 – 2026-10-02 | 532 | 2026-10-22T21:23:41.0530684Z |
| 2026-10-01 – 2026-10-01 | 685 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-30 – 2026-09-30 | 776 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-29 – 2026-09-29 | 773 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-28 – 2026-09-28 | 905 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-27 – 2026-09-27 | 215 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-26 – 2026-09-26 | 53 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-25 – 2026-09-25 | 583 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-24 – 2026-09-24 | 965 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-23 – 2026-09-23 | 1,114 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-22 – 2026-09-22 | 961 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-21 – 2026-09-21 | 557 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-20 – 2026-09-20 | 47 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-19 – 2026-09-19 | 41 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-18 – 2026-09-18 | 696 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-17 – 2026-09-17 | 741 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-16 – 2026-09-16 | 720 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-15 – 2026-09-15 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-14 – 2026-09-14 | 517 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-13 – 2026-09-13 | 31 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-12 – 2026-09-12 | 34 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-11 – 2026-09-11 | 479 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-10 – 2026-09-10 | 623 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-09 – 2026-09-09 | 761 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-08 – 2026-09-08 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-07 – 2026-09-07 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-06 – 2026-09-06 | 19 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-05 – 2026-09-05 | 35 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-04 – 2026-09-04 | 198 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-03 – 2026-09-03 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-02 – 2026-09-02 | 809 | 2026-10-22T21:23:41.0530684Z |
| 2026-09-01 – 2026-09-01 | 686 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-31 – 2026-08-31 | 572 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-30 – 2026-08-30 | 36 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-29 – 2026-08-29 | 57 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-28 – 2026-08-28 | 341 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-27 – 2026-08-27 | 422 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-26 – 2026-08-26 | 556 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-25 – 2026-08-25 | 423 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-24 – 2026-08-24 | 479 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-23 – 2026-08-23 | 47 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-22 – 2026-08-22 | 38 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-21 – 2026-08-21 | 425 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-20 – 2026-08-20 | 570 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-19 – 2026-08-19 | 617 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-18 – 2026-08-18 | 744 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-17 – 2026-08-17 | 470 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-16 – 2026-08-16 | 52 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-15 – 2026-08-15 | 105 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-14 – 2026-08-14 | 0 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-13 – 2026-08-13 | 599 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-12 – 2026-08-12 | 406 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-11 – 2026-08-11 | 320 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-10 – 2026-08-10 | 397 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-09 – 2026-08-09 | 91 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-08 – 2026-08-08 | 123 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-07 – 2026-08-07 | 384 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-06 – 2026-08-06 | 232 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-05 – 2026-08-05 | 354 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-04 – 2026-08-04 | 453 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-03 – 2026-08-03 | 327 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-02 – 2026-08-02 | 50 | 2026-10-22T21:23:41.0530684Z |
| 2026-08-01 – 2026-08-01 | 39 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-31 – 2026-07-31 | 290 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-30 – 2026-07-30 | 351 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-29 – 2026-07-29 | 418 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-28 – 2026-07-28 | 357 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-27 – 2026-07-27 | 323 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-26 – 2026-07-26 | 31 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-25 – 2026-07-25 | 30 | 2026-10-22T21:23:41.0530684Z |
| 2026-07-24 – 2026-07-24 | 200 | 2026-10-22T21:23:41.0530684Z |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:12 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:bea58acc3a93cedf3c94c1452aeb4a86504fb130b01957e07904d114f7f2ab73