summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go b/vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go
new file mode 100644
index 00000000..befcd4e9
--- /dev/null
+++ b/vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go
@@ -0,0 +1,15 @@
+package randbytes
+
+import (
+ "crypto/rand"
+ "fmt"
+)
+
+func Make(length int) []byte {
+ random := make([]byte, length)
+ _, err := rand.Read(random)
+ if err != nil {
+ panic(fmt.Errorf("failed to get random bytes: %w", err))
+ }
+ return random
+}