fix: create RandomGenerator interface and struct for testing purpose #181

This commit is contained in:
2024-10-05 13:49:43 +02:00
parent d36f880a01
commit 6b033e2c2e
6 changed files with 125 additions and 55 deletions

View File

@@ -1,16 +0,0 @@
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
}