MCPcopy Index your code
hub / github.com/coder/coder / hashOAuth2State

Function hashOAuth2State

coderd/oauth2provider/authorize.go:289–298  ·  view source on GitHub ↗

hashOAuth2State returns a SHA-256 hash of the OAuth2 state parameter. If the state is empty, it returns a null string.

(state string)

Source from the content-addressed store, hash-verified

287// hashOAuth2State returns a SHA-256 hash of the OAuth2 state parameter. If
288// the state is empty, it returns a null string.
289func hashOAuth2State(state string) sql.NullString {
290 if state == "" {
291 return sql.NullString{}
292 }
293 hash := sha256.Sum256([]byte(state))
294 return sql.NullString{
295 String: hex.EncodeToString(hash[:]),
296 Valid: true,
297 }
298}

Callers 2

TestHashOAuth2StateFunction · 0.85
ProcessAuthorizeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestHashOAuth2StateFunction · 0.68