From 1d75bf7489527925217bd5611ba7910c0ffe077c Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Tue, 9 Apr 2024 18:39:14 -0400 Subject: profiles (#7) Reviewed-on: https://git.hatecomputers.club/hatecomputers/hatecomputers.club/pulls/7 Co-authored-by: Elizabeth Co-committed-by: Elizabeth --- utils/random_id.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 utils/random_id.go (limited to 'utils/random_id.go') 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) +} -- cgit v1.2.3-70-g09d2