utils

package
v0.0.0-...-736cfa7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateExpiryTime

func CalculateExpiryTime(minutes int) time.Time

CalculateExpiryTime calculates the expiry time based on minutes

func GenerateOTP

func GenerateOTP(length int) (string, error)

GenerateOTP creates a random OTP of the specified length

func HashPassword

func HashPassword(password string) ([]byte, error)

HashPassword creates a bcrypt hash from the provided password

func VerifyPassword

func VerifyPassword(hashedPassword []byte, password string) error

VerifyPassword compares a bcrypt hashed password with its possible plaintext equivalent

Types

type OTPConfig

type OTPConfig struct {
	Length        int
	ExpiryMinutes int
}

OTPConfig holds configuration for OTP generation

func DefaultOTPConfig

func DefaultOTPConfig() OTPConfig

DefaultOTPConfig returns a default OTP configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL