I am batman
This commit is contained in:
15
internal/utils/tokenUtils.go
Normal file
15
internal/utils/tokenUtils.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func GenerateRandomToken() string {
|
||||
bytes := make([]byte, 16) // 16 bytes = 128 bits
|
||||
_, err := rand.Read(bytes)
|
||||
if err != nil {
|
||||
panic("Failed to generate random token")
|
||||
}
|
||||
return hex.EncodeToString(bytes)
|
||||
}
|
||||
Reference in New Issue
Block a user