You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wg-access-server/pkg/authnz/authutil/random.go

18 lines
274 B
Go

package authutil
import (
"crypto/rand"
"encoding/base64"
"github.com/sirupsen/logrus"
)
func RandomString(size int) string {
blk := make([]byte, size)
_, err := rand.Read(blk)
if err != nil {
logrus.Fatal(err)
}
return base64.StdEncoding.EncodeToString(blk)
}