Skip to content

Various improvements - #28

Merged
marcelkliemannel merged 11 commits into
masterfrom
develop
May 14, 2026
Merged

marcelkliemannel merged 11 commits into
masterfrom
develop

Conversation

@marcelkliemannel

Copy link
Copy Markdown
Owner

Added

  • Added secure default validation for HOTP and TOTP configuration values.
  • Added allowInsecureConfiguration opt-in for legacy or test-vector configurations with short code lengths or zero-length TOTP time steps.
  • Added GoogleAuthenticator.createSecureRandomSecretAsByteArray() for RFC 4226-sized 160-bit secrets.
  • Added validation for OTP Auth URI digits, periods, counters, and Base32 secrets.

Changed

  • Copied provided secret byte arrays before use so later caller mutations do not affect generators.
  • Switched HOTP, TOTP, and Google Authenticator code validation to constant-time byte comparisons.
  • Replaced floating-point HOTP modulo calculation with integer arithmetic.
  • Updated TOTP counter calculation to use integer floor division.
  • Clarified documentation around secure code digit ranges, zero time steps, and Google Authenticator-compatible secret lengths.
  • Expanded and tightened API documentation across generators, configuration, URI builder, algorithms, and secret generation.

Fixed

  • Rejected empty secrets for generator and URI-builder inputs.
  • Rejected empty random secret generation requests.
  • Rejected TOTP time steps that convert to less than one millisecond.

@marcelkliemannel
marcelkliemannel merged commit b402ba9 into master May 14, 2026
1 check passed
@marcelkliemannel
marcelkliemannel deleted the develop branch May 14, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant