hashOAuth2State returns a SHA-256 hash of the OAuth2 state parameter. If the state is empty, it returns a null string.
(state string)
| 287 | // hashOAuth2State returns a SHA-256 hash of the OAuth2 state parameter. If |
| 288 | // the state is empty, it returns a null string. |
| 289 | func 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 | } |
no outgoing calls