diff options
author | Jakob Unterwurzacher | 2025-08-03 13:40:49 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2025-08-03 21:25:24 +0200 |
commit | ae23a04951780377a7d7ede6af476eaee9efa49e (patch) | |
tree | 0a06ddd17cbfd2140d648ca533f33918324ef250 | |
parent | 33fa0b50cb8ab48e547c8cadcc025bbd40d9c8c7 (diff) |
cryptocore: add note about crypto/rand.Read errors
-rw-r--r-- | internal/cryptocore/nonce.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/cryptocore/nonce.go b/internal/cryptocore/nonce.go index 9df094c..c800807 100644 --- a/internal/cryptocore/nonce.go +++ b/internal/cryptocore/nonce.go @@ -11,6 +11,8 @@ func RandBytes(n int) []byte { b := make([]byte, n) _, err := rand.Read(b) if err != nil { + // crypto/rand.Read() is documented to never return an + // error, so this should never happen. Still, better safe than sorry. log.Panic("Failed to read random bytes: " + err.Error()) } return b |