accountserver/util/random.go

15 lines
202 B
Go
Raw Permalink Normal View History

2024-09-03 15:56:34 +02:00
package util
import (
"crypto/rand"
"io"
)
func GenerateRandomKey(length int) []byte {
k := make([]byte, length)
if _, err := io.ReadFull(rand.Reader, k); err != nil {
return nil
}
return k
}