GetRandomStr generates a cryptographically secure pseudorandom numbers of the given size in byte
(numBytes int)
| 36 | // GetRandomStr generates a cryptographically secure pseudorandom numbers of the |
| 37 | // given size in byte |
| 38 | func GetRandomStr(numBytes int) (string, error) { |
| 39 | b, err := getRandomBytes(numBytes) |
| 40 | if err != nil { |
| 41 | return "", errors.Wrap(err, "generating random bits") |
| 42 | } |
| 43 | |
| 44 | return base64.StdEncoding.EncodeToString(b), nil |
| 45 | } |
no test coverage detected