Documentation
¶
Overview ¶
Package crypto provides cryptographic utilities for the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateOTP ¶
GenerateOTP generates a cryptographically secure N-digit OTP. The digits parameter must be between 4 and 10.
func GenerateOTP4 ¶
GenerateOTP4 generates a cryptographically secure 4-digit OTP.
func GenerateOTP6 ¶
GenerateOTP6 generates a cryptographically secure 6-digit OTP. This is the most common OTP format.
func SecureCompare ¶
SecureCompare performs constant-time string comparison. This prevents timing attacks when comparing secrets like OTP codes.
func SecureCompareBytes ¶
SecureCompareBytes performs constant-time byte slice comparison.
func ValidateOTPFormat ¶
ValidateOTPFormat validates that the OTP has the correct format. It checks that the OTP is exactly expectedDigits long and contains only digits. Note: This does NOT verify correctness, only format.
Types ¶
This section is empty.