Files
licenseServer/internal/handlers/keygen.go
T
2026-05-05 08:44:55 +00:00

19 lines
331 B
Go

package handlers
import (
"crypto/rand"
"fmt"
"strings"
)
// GenerateKey produces a license key in the format XXXX-XXXX-XXXX-XXXX
func GenerateKey() string {
b := make([]byte, 8)
rand.Read(b)
hex := fmt.Sprintf("%X", b)
parts := []string{
hex[0:4], hex[4:8], hex[8:12], hex[12:16],
}
return strings.Join(parts, "-")
}