diff options
Diffstat (limited to 'nexus/utils/token/token.go')
| -rw-r--r-- | nexus/utils/token/token.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nexus/utils/token/token.go b/nexus/utils/token/token.go new file mode 100644 index 0000000..e517a15 --- /dev/null +++ b/nexus/utils/token/token.go @@ -0,0 +1,14 @@ +package token
+
+import (
+ "crypto/rand"
+ "encoding/hex"
+)
+
+func Generate() (string, error) {
+ bytes := make([]byte, 32)
+ if _, err := rand.Read(bytes); err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(bytes), nil
+}
|
