summaryrefslogtreecommitdiff
path: root/pkg/scrypto/random.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-09-30 00:58:49 +0200
committerJulien Dessaux2024-09-30 01:00:59 +0200
commit4ff490806c826cf2da4c2291ed924f0a49383fce (patch)
tree6870f4883cd03a824095b969500f08fb59f04038 /pkg/scrypto/random.go
parentchore(tfstated): rename tfstate to tfstated (diff)
downloadtfstated-4ff490806c826cf2da4c2291ed924f0a49383fce.tar.gz
tfstated-4ff490806c826cf2da4c2291ed924f0a49383fce.tar.bz2
tfstated-4ff490806c826cf2da4c2291ed924f0a49383fce.zip
feat(tfstated): implement GET and POST methods, states are encrypted in a sqlite3 database
Diffstat (limited to '')
-rw-r--r--pkg/scrypto/random.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/scrypto/random.go b/pkg/scrypto/random.go
new file mode 100644
index 0000000..47d9557
--- /dev/null
+++ b/pkg/scrypto/random.go
@@ -0,0 +1,16 @@
+package scrypto
+
+import (
+ "crypto/rand"
+ "fmt"
+)
+
+func RandomBytes(n int) []byte {
+ data := make([]byte, n)
+
+ if _, err := rand.Read(data); err != nil {
+ panic(fmt.Sprintf("cannot generate random data: %+v", err))
+ }
+
+ return data
+}