mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package secure
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
func RandomToken(n int) (string, error) {
|
||||
// n = bytes, 32 → 256-bit
|
||||
b := make([]byte, n)
|
||||
if _, err := rand.Read(b); err != nil { return "", err }
|
||||
return base64.RawURLEncoding.EncodeToString(b), nil
|
||||
}
|
||||
Reference in New Issue
Block a user