diff options
author | Elizabeth Hunt <elizabeth@simponic.xyz> | 2025-01-12 23:09:34 -0800 |
---|---|---|
committer | Elizabeth Hunt <elizabeth@simponic.xyz> | 2025-01-12 23:09:34 -0800 |
commit | 18a945aab9b3129b82076f633fab1d13ba28148e (patch) | |
tree | 09703cdc24992c42c5c14051e73e0b614280f5bd /utils/random_id.go | |
download | phoneassistant-18a945aab9b3129b82076f633fab1d13ba28148e.tar.gz phoneassistant-18a945aab9b3129b82076f633fab1d13ba28148e.zip |
initial commit by simponic-infra
Diffstat (limited to 'utils/random_id.go')
-rw-r--r-- | utils/random_id.go | 16 |
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) +} |