mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 16:43:08 +08:00
utils
This commit is contained in:
@ -101,3 +101,11 @@ func DecodeBasicAuthHeader(header string) (string, string, error) {
|
||||
|
||||
return userAndPass[0], userAndPass[1], nil
|
||||
}
|
||||
|
||||
func RandomHex(n int) (string, error) {
|
||||
bytes := make([]byte, n)
|
||||
if _, err := rand.Read(bytes); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(bytes), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user