Brandur e117c9fb6d
Expose Stripe::Webhook.compute_signature (#915)
Exposes the `.compute_signature` method, which may be useful when
testing webhook signing in test suites.

I change the API slightly so that a caller isn't forced to do as much
string mangling, and to match the one that we already have in stripe-go:

``` go
func ComputeSignature(t time.Time, payload []byte, secret string) []byte {
```

Add basic documentation and test case. I also change a few things around
so that we send `Time` objects around more often where applicable, and
don't change then to Unix integers until the last moment that we need
to.

The one other alternative API I considered is this one, which would
default the timestamp to the current time to allow the method to be
called with one fewer arg:

``` ruby
def self.compute_signature(payload, secret: timestamp: Time.now)
```

I decided against it in the end though because it does remove some
explicitness, and it's not a big deal to just pass in `Time.now`,
especially given that this is not expected to be a commonly used method.

Fixes #912.
2020-04-24 10:58:42 -07:00
..
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-11-05 19:36:41 -08:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00
2019-08-20 11:35:24 -07:00