summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2025-01-03 01:47:07 -0800
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2025-01-03 01:47:07 -0800
commitf163a242792cd325c9414587d52f3d8584f28df1 (patch)
treeb57ad121cc3f4ffc2bc55f4d63bfaaf6026dd239 /utils
downloadphoneof-f163a242792cd325c9414587d52f3d8584f28df1.tar.gz
phoneof-f163a242792cd325c9414587d52f3d8584f28df1.zip
initial commit
Diffstat (limited to 'utils')
-rw-r--r--utils/random_id.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/random_id.go b/utils/random_id.go
new file mode 100644
index 0000000..1b03ec8
--- /dev/null
+++ b/utils/random_id.go
@@ -0,0 +1,16 @@
+package utils
+
+import (
+ "crypto/rand"
+ "fmt"
+)
+
+func RandomId() string {
+ id := make([]byte, 16)
+ _, err := rand.Read(id)
+ if err != nil {
+ panic(err)
+ }
+
+ return fmt.Sprintf("%x", id)
+}