Skip to content

fix: use crypto/rand for OTP generation#489

Merged
lakhansamani merged 3 commits intomainfrom
fix/secure-otp-generation
Mar 1, 2026
Merged

fix: use crypto/rand for OTP generation#489
lakhansamani merged 3 commits intomainfrom
fix/secure-otp-generation

Conversation

@lakhansamani
Copy link
Contributor

Summary

  • Replaced insecure math/rand with crypto/rand for OTP generation
  • Removed per-call re-seeding that caused identical OTPs for concurrent calls

Test plan

  • Verify OTPs are generated correctly with 6 characters
  • Verify concurrent OTP generation produces unique values

Fixes #478

Replaced insecure math/rand with crypto/rand for cryptographically
secure OTP generation. The previous implementation was predictable
and could produce identical OTPs for concurrent calls.

Fixes #478
@lakhansamani lakhansamani merged commit 695952e into main Mar 1, 2026
@lakhansamani lakhansamani deleted the fix/secure-otp-generation branch March 1, 2026 06:48
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.

OTP generated with insecure math/rand

1 participant