MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / Nonce

Function Nonce

pkg/encryption/nonce.go:11–18  ·  view source on GitHub ↗

Nonce generates a random n-byte slice

(length int)

Source from the content-addressed store, hash-verified

9
10// Nonce generates a random n-byte slice
11func Nonce(length int) ([]byte, error) {
12 b := make([]byte, length)
13 _, err := rand.Read(b)
14 if err != nil {
15 return nil, err
16 }
17 return b, nil
18}
19
20// HashNonce returns the SHA256 hash of a nonce
21func HashNonce(nonce []byte) string {

Callers 4

RunClientTestsFunction · 0.92
NewCSRFFunction · 0.92

Calls 1

ReadMethod · 0.45

Tested by 2

RunClientTestsFunction · 0.74