package utils import ( "crypto/rand" "encoding/hex" "io" "github.com/andybalholm/brotli" "github.com/klauspost/compress/flate" "github.com/klauspost/compress/gzip" ) func GenerateActivationCode() string { bytes := make([]byte, 16) if _, err := rand.Read(bytes); err != nil { Logger.Fatalf("Error generating activation code: %v", err) } return hex.EncodeToString(bytes) } func DecompressResponseBody(encoding string, body io.Reader) (io.ReadCloser, error) { switch encoding { case "gzip": return gzip.NewReader(body) case "deflate": return flate.NewReader(body), nil case "br": return io.NopCloser(brotli.NewReader(body)), nil default: return io.NopCloser(body), nil } }