OpenID Connect (OIDC) identity and OAuth 2.0 provider with pluggable connectors
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package crypto |
|
|
|
import ( |
|
"crypto/rand" |
|
"errors" |
|
) |
|
|
|
func RandBytes(n int) ([]byte, error) { |
|
b := make([]byte, n) |
|
got, err := rand.Read(b) |
|
if err != nil { |
|
return nil, err |
|
} |
|
if n != got { |
|
return nil, errors.New("unable to generate enough random data") |
|
} |
|
return b, nil |
|
}
|
|
|