(length int)
| 24 | } |
| 25 | |
| 26 | func generateRandomString(length int) string { |
| 27 | bytes := make([]byte, length) |
| 28 | _, err := rand.Read(bytes) |
| 29 | if err != nil { |
| 30 | return "" |
| 31 | } |
| 32 | return hex.EncodeToString(bytes) |
| 33 | } |
| 34 | |
| 35 | func CSPMiddleware(next http.Handler) http.Handler { |
| 36 | // To use the same nonces in all responses, move the Nonces |