Stack of changes to get gin, scs, nosurf running.
This commit is contained in:
15
internal/helpers/security/tokens.go
Normal file
15
internal/helpers/security/tokens.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package security
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func GenerateSecureToken() (string, error) {
|
||||
b := make([]byte, 32)
|
||||
_, err := rand.Read(b)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(b), nil
|
||||
}
|
||||
Reference in New Issue
Block a user