aboutsummaryrefslogtreecommitdiff
path: root/utils/validators
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-07-13 14:22:20 +0530
committerBobby <[email protected]>2025-07-13 14:22:20 +0530
commit3d7f8602d45583f25e2428bf6f8123453646dc08 (patch)
treeecd707d298099ae9fda55efc3f0d1daf48f7b6e9 /utils/validators
parentbf112649d039f8f02e2135a74d8b506f7c31c784 (diff)
downloadimageboard-3d7f8602d45583f25e2428bf6f8123453646dc08.tar.xz
imageboard-3d7f8602d45583f25e2428bf6f8123453646dc08.zip
registration controllers and email sending support
Diffstat (limited to 'utils/validators')
-rw-r--r--utils/validators/tokens.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/validators/tokens.go b/utils/validators/tokens.go
new file mode 100644
index 0000000..f377c2e
--- /dev/null
+++ b/utils/validators/tokens.go
@@ -0,0 +1,14 @@
+package validators
+
+import (
+ "crypto/rand"
+ "encoding/hex"
+)
+
+func GenerateRandomToken() (string, error) {
+ bytes := make([]byte, 32)
+ if _, err := rand.Read(bytes); err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(bytes), nil
+}