increase 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9520a7eb024d05477e162e1158a07f54167a6a89297f44d3a71caa01a40599cf
4
- data.tar.gz: 273bb964f85fb97660212f6a2046a58caf4e7302d07859fe3d562afe8269922d
3
+ metadata.gz: 316c9f7266fa873bde94e93509769dc4883691aa435da355d636a94f9c48b762
4
+ data.tar.gz: c38729a1d10974a7e46911e834c539b9931f18380d9e20aedcc71bc810fdb22d
5
5
  SHA512:
6
- metadata.gz: d4b399cda4f620ca00549831546a4992069eb17cb84f08ce9aa0039744e7d3ea4868dd3498ee593c001678633bf708a6e8257ee093f75922996c0f1012f9aa6d
7
- data.tar.gz: bfd03c310aaf256d89228e6bcd0da10e3505004ab958c10c30baa51dd6df1c22d09ca974bcd61def524888dc9203a00fef78a51082991d2dd3aa8701f6060294
6
+ metadata.gz: d7b31744c795da1c21e7f7dc85721bfeacdf115de67dee45a2751adc1a4e1d97d8a8fe69bac13d658921aeaf42873bbbe400d835e9f1a1a6e77941a19f5154bb
7
+ data.tar.gz: 1f89985c494abd6b3e50df9d24a21cc1d0078b576b20010a04a11ab666ad3c8f55e910fc7959d0ae10ed72dd40bd8eae6fdc7f91dbfe71e5f91c14cd7d756da9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.2] - 2023-03-24
4
+
5
+ ### Fixes
6
+
7
+ - Updated `Increase::Webhook::Signature#verify` to
8
+ raise `WebhookSignatureVerificationError` when arguments are `nil`
9
+
3
10
  ## [0.3.1] - 2023-03-23
4
11
 
5
12
  ### Enhancements
data/README.md CHANGED
@@ -19,14 +19,14 @@ Bare-Metal Banking APIs!
19
19
  Install the gem and add to the application's Gemfile by executing:
20
20
 
21
21
  ```sh
22
- $ bundle add increase -v 0.3.1
22
+ $ bundle add increase -v 0.3.2
23
23
  ```
24
24
 
25
25
  If bundler is not being used to manage dependencies, install the gem by
26
26
  executing:
27
27
 
28
28
  ```sh
29
- $ gem install increase -v 0.3.1
29
+ $ gem install increase -v 0.3.2
30
30
  ```
31
31
 
32
32
  ## Usage
@@ -326,14 +326,15 @@ to run the console with your Increase sandbox API key pre-filled.
326
326
 
327
327
  To install this gem onto your local machine, run `bundle exec rake install`.
328
328
 
329
- To release a new version, update the version number in `version.rb`, and then
330
- run `bundle exec rake release`, which will create a git tag for the version,
331
- push git commits and the created tag, and push the `.gem` file
332
- to [rubygems.org](https://rubygems.org).
329
+ To release a new version:
333
330
 
334
- Alternatively, use [`gem-release`](https://github.com/svenfuchs/gem-release) and
335
- run `gem bump --version patch|minor|major`. Then release the gem by
336
- running `bundle exec rake release`.
331
+ - `gem bump --version patch|minor|major`
332
+ - Make sure you
333
+ have [`gem-release`](https://github.com/svenfuchs/gem-release)
334
+ installed
335
+ - Update the CHANGELOG and README if necessary
336
+ - `bundle exec rake release`
337
+ - Create release on GitHub from newly created tag
337
338
 
338
339
  ## Contributing
339
340
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Increase
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
@@ -23,7 +23,7 @@ module Increase
23
23
  end
24
24
 
25
25
  # Parse header
26
- sig_values = signature_header.split(",").map { |pair| pair.split("=") }.to_h
26
+ sig_values = signature_header&.split(",")&.map { |pair| pair.split("=") }&.to_h || {}
27
27
 
28
28
  # Extract values
29
29
  t = sig_values["t"] # Should be a string (ISO-8601 timestamp)
@@ -32,6 +32,8 @@ module Increase
32
32
  raise sig_error.call("No signature found with scheme #{scheme} in signature header") if sig.nil?
33
33
 
34
34
  # Check signature
35
+ raise sig_error.call("Webhook secret is required") if secret.nil?
36
+ raise sig_error.call("Payload is required") if payload.nil?
35
37
  expected_sig = compute_signature(timestamp: t, payload: payload, secret: secret)
36
38
  matches = Util.secure_compare(expected_sig, sig)
37
39
  raise sig_error.call("Signature mismatch") unless matches
@@ -56,6 +58,10 @@ module Increase
56
58
  end
57
59
 
58
60
  def self.compute_signature(timestamp:, payload:, secret:)
61
+ raise ArgumentError, "timestamp is required" if timestamp.nil?
62
+ raise ArgumentError, "payload is required" if payload.nil?
63
+ raise ArgumentError, "secret is required" if secret.nil?
64
+
59
65
  signed_payload = timestamp.to_s + "." + payload.to_s
60
66
  OpenSSL::HMAC.hexdigest("SHA256", secret, signed_payload)
61
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: increase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Tou