fix: refactor random
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 44s

This commit is contained in:
2024-09-13 17:06:29 +02:00
parent 63ddf77d6a
commit 74816b60da
2 changed files with 21 additions and 11 deletions

16
utils/ctypto.go Normal file
View File

@@ -0,0 +1,16 @@
package utils
import (
"crypto/rand"
"encoding/base64"
)
func RandomToken() (string, error) {
b := make([]byte, 32)
_, err := rand.Read(b)
if err != nil {
return "", err
}
return base64.StdEncoding.EncodeToString(b), nil
}