lib/token.go
package lib import ( "crypto/rand" "encoding/hex" ) func GenerateSecureToken(length int) string { b := make([]byte, length) if _, err := rand.Read(b); err != nil { return "" } return hex.EncodeToString(b) }