unstale

npm / otplib

otplib

What changed in otplib 12 to 13, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

6 breaking11 security6 new APIs and options1 performance2 behavior and defaults1 tooling3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

otplib 1327 changes

Breaking changes 5

  • The CLI build target was raised to Node 22, which may affect the Node.js versions that can run it.

    13.6.0release notes

  • All crypto plugins now reject unsupported hash algorithm strings instead of silently substituting a different digest; accepted algorithms and aliases are documented.

    13.5.0release notes

  • Unsupported hash algorithms now throw AlgorithmUnsupportedError, giving callers a specific error to handle instead of plugin-dependent errors or silent fallback.

    13.5.0release notes

  • HOTP counterTolerance now uses tuple semantics with type [number, number] and a look-ahead default; check existing HOTP tolerance values.

    13.2.0release notes

  • Secrets now require a minimum of 16 bytes; override MIN_SECRET_BYTES to interoperate with shorter existing secrets.

    13.0.0release notes

Security 11

  • URI errors no longer expose secrets, and generate parameters are validated.

    13.6.0release notes

  • The CLI enforces 0600 permissions on vault and key files and gitignores them.

    13.6.0release notes

  • An ajv override was added to address a moderate ReDoS vulnerability.

    13.4.0release notes

  • A markdown-it ReDoS vulnerability was resolved.

    13.4.0release notes

  • An undici override was added to address a security alert.

    13.4.0release notes

  • OTP validation was hardened.

    13.3.0release notes

  • Security improvements were made; the notes do not specify their details.

    13.3.0release notes

  • An HOTP update-counter command was added.

    13.3.0release notes

  • URI parsing was hardened.

    13.3.0release notes

  • Adds the afterTimeStep parameter for TOTP replay protection.

    13.2.0release notes

  • The guardrails parameter now propagates through HOTP and TOTP call chains.

    13.1.1release notes

New APIs and options 5

  • otplib adds IIFE and CDN build support, enabling those build formats.

    13.4.0release notes

  • OTPHooks were added for custom token encoding and validation.

    13.3.0release notes

  • Adds hex and base64 bypass plugins.

    13.2.0release notes

  • Adds a plugin for bypassing Base32 encoding.

    13.2.0release notes

  • Guardrails can now be overridden.

    13.1.0release notes

Behavior and default changes 2

  • TOTP replay controls are now bubbled up through otplib.

    13.3.0release notes

  • generateURI now supports HOTP as well as TOTP strategies.

    13.1.0release notes

Tooling 1

  • An otplib CLI application was added for developers to use.

    13.3.0release notes

Fixes and other changes 3

  • generateSync now passes hooks through, allowing callers to use hooks when generating synchronously.

    13.6.0release notes

  • Adapters now honour base64, latin1 and ascii key encodings.

    13.6.0release notes

  • Subpath exports were fixed to resolve Node 10 compatibility failures.

    13.6.0release notes

otplib 123 changes

Breaking changes 1

  • The library was split into core, plugin and preset packages, changing its package structure.

    12.0.0release notes

New APIs and options 1

Performance 1