aboutsummaryrefslogtreecommitdiff
path: root/utils/validators/tokens.go
blob: f377c2e7e3fc76371aaff86518ebbc4aec6e6b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package validators

import (
	"crypto/rand"
	"encoding/hex"
)

func GenerateRandomToken() (string, error) {
	bytes := make([]byte, 32)
	if _, err := rand.Read(bytes); err != nil {
		return "", err
	}
	return hex.EncodeToString(bytes), nil
}