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

Function GenerateCodeVerifierString

pkg/encryption/utils.go:87–93  ·  view source on GitHub ↗

GenerateCodeVerifierString returns a base64 encoded string of n random bytes

(n int)

Source from the content-addressed store, hash-verified

85
86// GenerateCodeVerifierString returns a base64 encoded string of n random bytes
87func GenerateCodeVerifierString(n int) (string, error) {
88 data := make([]byte, n)
89 if _, err := io.ReadFull(rand.Reader, data); err != nil {
90 return "", err
91 }
92 return base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(data), nil
93}
94
95func GenerateCodeChallenge(method, codeVerifier string) (string, error) {
96 switch method {

Callers 2

doOAuthStartMethod · 0.92

Calls

no outgoing calls

Tested by 1