How do I generate a signed Stripe rest webhook request locally?

I think the issue has to do with the curl call. The -d/--data argument is stripping any line breaks from your json and the resulting digest computed by Stripe::Webhook.construct_event is different than what you've computed in the terminal.

After generating a digest I curled at my webhook endpoint:

Using the standard -d, threw an error saying the signature was invalid

curl -s -X POST http://localhost:3000/webhook  -H "Stripe-Signature: t=1509309309,v1=a2e2776cd5a57ba60355f7cfa3bcdd1d69e773373a0da" -d @./webhook.json.tmp

Whereas, specifying the --data-binary returned a valid signature

curl -s -X POST http://localhost:3000/webhook  -H "Stripe-Signature: t=1509309309,v1=a2e2776cd5a57ba60355f7cfa3bcdd1d69e773373a0da" --data-binary @./webhook.json.tmp