Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CryptoGenerator ¶
type CryptoGenerator struct{}
CryptoGenerator methods produce cryptographically secure random data
func (CryptoGenerator) RandomBytes ¶
func (g CryptoGenerator) RandomBytes(n int) ([]byte, error)
RandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue. Taken from https://stackoverflow.com/questions/35781197/generating-a-random-fixed-length-byte-array-in-go
func (CryptoGenerator) RandomString ¶
func (g CryptoGenerator) RandomString(n int) (string, error)
RandomString returns a URL-safe, base64 encoded, securely generated, random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue. This should be used when there are concerns about security and need something cryptographically secure.