This repository has been archived on 2025-08-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
web-app-template/utils/ctypto.go
Tim Wundenberg 74816b60da
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 44s
fix: refactor random
2024-09-13 17:06:29 +02:00

17 lines
235 B
Go

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
}