diff options
author | Julien Dessaux | 2024-09-30 00:58:49 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-09-30 01:00:59 +0200 |
commit | 4ff490806c826cf2da4c2291ed924f0a49383fce (patch) | |
tree | 6870f4883cd03a824095b969500f08fb59f04038 /pkg/scrypto/random.go | |
parent | chore(tfstated): rename tfstate to tfstated (diff) | |
download | tfstated-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 'pkg/scrypto/random.go')
-rw-r--r-- | pkg/scrypto/random.go | 16 |
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 +} |