feat: initial commit

This commit is contained in:
2025-02-21 18:42:56 +01:00
commit ee4a65b345
81 changed files with 3441 additions and 0 deletions

22
internal/crypto/rand.go Normal file
View File

@ -0,0 +1,22 @@
package crypto
import (
"crypto/rand"
"github.com/pkg/errors"
)
func RandomBytes(size int) ([]byte, error) {
data := make([]byte, size)
read, err := rand.Read(data)
if err != nil {
return nil, errors.WithStack(err)
}
if read != size {
return nil, errors.New("unexpected number of read bytes")
}
return data, nil
}