package utils import ( "crypto/rand" "encoding/hex" ) func GenerateSessionId(length int) string { bytes := make([]byte, length) // 16 bytes = 128 bits _, err := rand.Read(bytes) if err != nil { panic("failed to generate session ID") } return hex.EncodeToString(bytes) } func GenerateToken() string { return GenerateSessionId(16) }