package auth import ( "crypto/rand" "crypto/sha256" "encoding/hex" "fmt" ) func GenerateSessionID() (string, error) { b := make([]byte, 32) if _, err := rand.Read(b); err != nil { return "", fmt.Errorf("generate session ID: %w", err) } return hex.EncodeToString(b), nil } func HashSessionID(raw string) string { h := sha256.Sum256([]byte(raw)) return hex.EncodeToString(h[:]) }