yeojz/otplib
yeojz/otplib has 2,308 GitHub stars and 146 forks. GitHot measured +4 in 7 days. Last checked 2026-11-11 10:47 UTC. Last push 2026-11-02.
Comment ces chiffres sont mesurés
One Time Password (OTP) / 2FA for Node.js and Browser - Supports HOTP, TOTP and Google Authenticator
What you can do
- Zero Configuration - Works out of the box with sensible defaults
- RFC Compliant - RFC 6238 (TOTP) and RFC 4226 (HOTP) + Google Authenticator Compatible
- TypeScript-First - Full type definitions
- Plugin Interface - Flexible plugin system for customising your cryptographic and base32 requirements (if you want to deviate from the defaults)
Progression mesurée des étoiles
- in 24h
- Mise à jour retardée
- in 7 days
- +4
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Originalotplib-repo
TypeScript-first library for HOTP and TOTP / Authenticator with multi-runtime (Node, Bun, Deno, Browser) support via plugins.
[!TIP]
A web based demo is available at https://otplib.yeojz.dev.
You can scan and test the TOTP / HOTP QR Code samples with your chosen authenticator app.
Features
- Zero Configuration - Works out of the box with sensible defaults
- RFC Compliant - RFC 6238 (TOTP) and RFC 4226 (HOTP) + Google Authenticator Compatible
- TypeScript-First - Full type definitions
- Plugin Interface - Flexible plugin system for customising your cryptographic and base32 requirements (if you want to deviate from the defaults)
- Cross-platform - Tested against Node.js, Bun, Deno, and browsers
- Security-audited plugins — Default crypto uses
@noble/hashesand@scure/base, both independently audited - Async-first API — All operations are async by default; sync variants available for compatible plugins
[!IMPORTANT]
v13 is a complete rewrite with breaking changes. For example:
- (Removed) Separate authenticator package — TOTP now covers all authenticator functionality with default plugins
- (Removed) Outdated plugins — Legacy crypto adapters removed in favor of modern, audited alternatives
See Migration Guide for details.
Quick Start
# Node
npm install otplib
pnpm add otplib
yarn add otplib
# Other runtimes
bun add otplib
deno install npm:otplib
import { generateSecret, generate, verify, generateURI } from "otplib";
// Generate a secret
const secret = generateSecret();
// Generate a TOTP token
const token = await generate({ secret });
// Verify a token
const result = await verify({ secret, token });
console.log(result.valid); // true
Packages
Documentation
Refer to the Getting Started Guide, or check out the other sections in the guide:
Contributing
See CONTRIBUTING.md for development setup and guidelines.
AI Usage Disclosure
Since v13, parts of the codebase, tests, and documentation have been refined with AI assistance, with all outputs reviewed by humans. See CONTRIBUTING.md for guidelines.
License
Explorer des projets similaires
codecrafters-io/build-your-own-x
Maîtrisez la programmation en recréant de zéro vos technologies préférées.
561,746 étoilespublic-apis/public-apis
Une liste collective d'API gratuites
498,144 étoilesmorluto/rea
Rétro-ingénierie de n'importe quoi avec des agents, du comportement des applications jusqu'aux binaires natifs.
451,696 étoilesopenclaw/openclaw
L'IA qui fait vraiment les choses. Tout système d'exploitation, toute plateforme. À la manière du homard. 🦞
394,331 étoiles