GenerateRandomSecret returns a cryptographically-secure 160-bit random number encoded as a hex string.
()
| 117 | |
| 118 | // GenerateRandomSecret returns a cryptographically-secure 160-bit random number encoded as a hex string. |
| 119 | func GenerateRandomSecret() (string, error) { |
| 120 | val, err := randCryptoHex(160) |
| 121 | if err != nil { |
| 122 | return "", fmt.Errorf("RNG failed, can't create password: %w", err) |
| 123 | } |
| 124 | return val, nil |
| 125 | } |
| 126 | |
| 127 | // GenerateRandomID returns a cryptographically-secure 128-bit random number encoded as a hex string. |
| 128 | func GenerateRandomID() (string, error) { |