summaryrefslogtreecommitdiff
path: root/pkg/pls/random.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-28 16:51:56 -0600
committermo khan <mo@mokhan.ca>2025-04-28 16:51:56 -0600
commit059a87a80227426f854256139bbbc7309bdb6fa0 (patch)
treeebd83f6a0f57133c9a34fffaf8c20ed6d62d9250 /pkg/pls/random.go
parent37adeb5437d0f62f5dbc137bb98addcb9d891238 (diff)
feat: redirect to login page when session is established
Diffstat (limited to 'pkg/pls/random.go')
-rw-r--r--pkg/pls/random.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/pls/random.go b/pkg/pls/random.go
new file mode 100644
index 0000000..f7935f1
--- /dev/null
+++ b/pkg/pls/random.go
@@ -0,0 +1,12 @@
+package pls
+
+import (
+ "crypto/rand"
+ "encoding/hex"
+)
+
+func GenerateRandomHex(length int) string {
+ nonceBytes := make([]byte, length)
+ rand.Read(nonceBytes)
+ return hex.EncodeToString(nonceBytes)
+}