m2m_keygen 0.4.3 → 0.4.5

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: 97b919ad7e666502842c42a4722d99e10237288033a561943798c317fd73cbf8
4
- data.tar.gz: 0a70ea67255c9b67dad4a07141aa7d403104edfb2dc8db4b6c82613c7565e101
3
+ metadata.gz: 2e2806db77237a92193c897dd269a5f82bc7a8428c3abf0be500e44e971daad7
4
+ data.tar.gz: 2727209266923a5c77f8dc43b60fc74532dcf89d501f6f42fb2074d760dd95ec
5
5
  SHA512:
6
- metadata.gz: 3a085c056d0c3ab39fef8c2d36f17b782aa5dbef6a2af6e7b7083198b72949730141e5fc20624bd757c2452aecaba5365a907b22cd88e274984605b5aaa3e46a
7
- data.tar.gz: 7de0d94e000a63f99a0a3ee31446531fbf470b2edc769b4f320cd979c21b5b5953f573e89497658b817de9c820c34b621cdfaad20e12ab5dec22459645640557
6
+ metadata.gz: 2a38e8fc99501194f21fab88fa6035e60f77419628c57cf393ce22020265020c5d120842133a4a1f4d79d586ec1f39b4a67c2f5362d8f73708e79e9db8a0abd4
7
+ data.tar.gz: ff5e60ebb5591ef97725bd3992e1e9683c59790e53ad64558892b3d072962a321b32a227607cdce0717d393340c416f422d00becd2e6467bfab523e78cea8253
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.5] - 2022-11-14
11
+
12
+ ### Fixed
13
+
14
+ - Expiry can be part of JSON body
15
+
16
+ ## [0.4.4] - 2022-11-14
17
+
18
+ ### Changed
19
+
20
+ - Body is parsed as JSON and added to the query string
21
+
10
22
  ## [0.4.3] - 2022-10-12
11
23
 
12
24
  ### Changed
@@ -55,7 +67,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55
67
 
56
68
  - Basic skeleton for gem
57
69
 
58
- [unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.3...HEAD
70
+ [unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.5...HEAD
71
+ [0.4.5]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.5
72
+ [0.4.4]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.4
59
73
  [0.4.3]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.3
60
74
  [0.4.2]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.2
61
75
  [0.4.1]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- m2m_keygen (0.4.3)
4
+ m2m_keygen (0.4.5)
5
5
  rack
6
6
  sorbet-runtime
7
7
  zeitwerk (~> 2.6)
@@ -28,7 +28,7 @@ GEM
28
28
  docile (1.4.0)
29
29
  dotenv (2.8.1)
30
30
  e2mmap (0.1.0)
31
- faker (2.23.0)
31
+ faker (3.0.0)
32
32
  i18n (>= 1.8.11, < 2)
33
33
  ffi (1.15.5)
34
34
  formatador (1.1.0)
@@ -46,7 +46,7 @@ GEM
46
46
  guard (~> 2.1)
47
47
  guard-compat (~> 1.1)
48
48
  rspec (>= 2.99.0, < 4.0)
49
- haml (6.0.6)
49
+ haml (6.0.10)
50
50
  temple (>= 0.8.2)
51
51
  thor
52
52
  tilt
@@ -67,9 +67,9 @@ GEM
67
67
  minitest (5.16.3)
68
68
  nenv (0.3.0)
69
69
  netrc (0.11.0)
70
- nokogiri (1.13.8-arm64-darwin)
70
+ nokogiri (1.13.9-arm64-darwin)
71
71
  racc (~> 1.4)
72
- nokogiri (1.13.8-x86_64-linux)
72
+ nokogiri (1.13.9-x86_64-linux)
73
73
  racc (~> 1.4)
74
74
  notiffany (0.1.3)
75
75
  nenv (~> 0.1)
@@ -85,7 +85,7 @@ GEM
85
85
  syntax_tree (>= 2.7.1)
86
86
  syntax_tree-haml (>= 1.1.0)
87
87
  syntax_tree-rbs (>= 0.2.0)
88
- prettier_print (0.1.0)
88
+ prettier_print (1.1.0)
89
89
  pry (0.14.1)
90
90
  coderay (~> 1.1)
91
91
  method_source (~> 1.0)
@@ -109,33 +109,33 @@ GEM
109
109
  reverse_markdown (2.1.1)
110
110
  nokogiri
111
111
  rexml (3.2.5)
112
- rspec (3.11.0)
113
- rspec-core (~> 3.11.0)
114
- rspec-expectations (~> 3.11.0)
115
- rspec-mocks (~> 3.11.0)
116
- rspec-core (3.11.0)
117
- rspec-support (~> 3.11.0)
118
- rspec-expectations (3.11.1)
112
+ rspec (3.12.0)
113
+ rspec-core (~> 3.12.0)
114
+ rspec-expectations (~> 3.12.0)
115
+ rspec-mocks (~> 3.12.0)
116
+ rspec-core (3.12.0)
117
+ rspec-support (~> 3.12.0)
118
+ rspec-expectations (3.12.0)
119
119
  diff-lcs (>= 1.2.0, < 2.0)
120
- rspec-support (~> 3.11.0)
121
- rspec-mocks (3.11.1)
120
+ rspec-support (~> 3.12.0)
121
+ rspec-mocks (3.12.0)
122
122
  diff-lcs (>= 1.2.0, < 2.0)
123
- rspec-support (~> 3.11.0)
124
- rspec-support (3.11.1)
123
+ rspec-support (~> 3.12.0)
124
+ rspec-support (3.12.0)
125
125
  rspec_in_context (1.1.0.3)
126
126
  activesupport (> 2.0)
127
127
  rspec (> 3.0)
128
- rubocop (1.36.0)
128
+ rubocop (1.39.0)
129
129
  json (~> 2.3)
130
130
  parallel (~> 1.10)
131
131
  parser (>= 3.1.2.1)
132
132
  rainbow (>= 2.2.2, < 4.0)
133
133
  regexp_parser (>= 1.8, < 3.0)
134
134
  rexml (>= 3.2.5, < 4.0)
135
- rubocop-ast (>= 1.20.1, < 2.0)
135
+ rubocop-ast (>= 1.23.0, < 2.0)
136
136
  ruby-progressbar (~> 1.7)
137
137
  unicode-display_width (>= 1.4.0, < 3.0)
138
- rubocop-ast (1.21.0)
138
+ rubocop-ast (1.23.0)
139
139
  parser (>= 3.1.1.0)
140
140
  rubocop-faker (1.1.0)
141
141
  faker (>= 2.12.0)
@@ -168,39 +168,38 @@ GEM
168
168
  thor (~> 1.0)
169
169
  tilt (~> 2.0)
170
170
  yard (~> 0.9, >= 0.9.24)
171
- sorbet (0.5.10484)
172
- sorbet-static (= 0.5.10484)
173
- sorbet-runtime (0.5.10484)
174
- sorbet-static (0.5.10484-universal-darwin-21)
175
- sorbet-static (0.5.10484-x86_64-linux)
176
- sorbet-static-and-runtime (0.5.10484)
177
- sorbet (= 0.5.10484)
178
- sorbet-runtime (= 0.5.10484)
171
+ sorbet (0.5.10554)
172
+ sorbet-static (= 0.5.10554)
173
+ sorbet-runtime (0.5.10554)
174
+ sorbet-static (0.5.10554-universal-darwin-21)
175
+ sorbet-static (0.5.10554-x86_64-linux)
176
+ sorbet-static-and-runtime (0.5.10554)
177
+ sorbet (= 0.5.10554)
178
+ sorbet-runtime (= 0.5.10554)
179
179
  spoom (1.1.12)
180
180
  sorbet (>= 0.5.9204)
181
181
  sorbet-runtime (>= 0.5.9204)
182
182
  thor (>= 0.19.2)
183
- syntax_tree (3.6.3)
184
- prettier_print
185
- syntax_tree-haml (1.3.2)
186
- haml (>= 5.2)
187
- prettier_print
188
- syntax_tree (>= 2.0.1)
183
+ syntax_tree (5.0.1)
184
+ prettier_print (>= 1.1.0)
185
+ syntax_tree-haml (2.0.0)
186
+ haml (>= 5.2, != 6.0.0)
187
+ prettier_print (>= 1.0.0)
188
+ syntax_tree (>= 4.0.0)
189
189
  syntax_tree-rbs (0.5.1)
190
190
  prettier_print
191
191
  rbs
192
192
  syntax_tree (>= 2.0.1)
193
- tapioca (0.10.2)
193
+ tapioca (0.10.3)
194
194
  bundler (>= 1.17.3)
195
195
  netrc (>= 0.11.0)
196
196
  parallel (>= 1.21.0)
197
- pry (>= 0.12.2)
198
- rbi (~> 0.0.0, >= 0.0.14)
199
- sorbet-static-and-runtime (>= 0.5.9204)
197
+ rbi (~> 0.0.0, >= 0.0.16)
198
+ sorbet-static-and-runtime (>= 0.5.9892)
200
199
  spoom (~> 1.1.0, >= 1.1.11)
201
200
  thor (>= 1.2.0)
202
201
  yard-sorbet
203
- temple (0.8.2)
202
+ temple (0.9.1)
204
203
  thor (1.2.1)
205
204
  tilt (2.0.11)
206
205
  tzinfo (2.0.5)
@@ -215,7 +214,7 @@ GEM
215
214
  yard-sorbet (0.7.0)
216
215
  sorbet-runtime (>= 0.5)
217
216
  yard (>= 0.9)
218
- zeitwerk (2.6.1)
217
+ zeitwerk (2.6.6)
219
218
 
220
219
  PLATFORMS
221
220
  arm64-darwin-21
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Wed Oct 12 11:55:54 2022 by
128
+ Generated on Mon Nov 14 18:18:15 2022 by
129
129
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.28 (ruby-3.1.2).
131
131
  </div>
@@ -311,7 +311,7 @@
311
311
  </div>
312
312
 
313
313
  <div id="footer">
314
- Generated on Wed Oct 12 11:55:54 2022 by
314
+ Generated on Mon Nov 14 18:18:15 2022 by
315
315
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
316
316
  0.9.28 (ruby-3.1.2).
317
317
  </div>
@@ -495,7 +495,8 @@
495
495
  29
496
496
  30
497
497
  31
498
- 32</pre>
498
+ 32
499
+ 33</pre>
499
500
  </td>
500
501
  <td>
501
502
  <pre class="code"><span class="info file"># File 'lib/m2m_keygen/rack_validator.rb', line 22</span>
@@ -503,8 +504,9 @@
503
504
  <span class='kw'>def</span> <span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span>
504
505
  <span class='comment'># This will cover the case when Rails is used.
505
506
  </span> <span class='id identifier rubyid_req'>req</span> <span class='op'>=</span> <span class='const'>Rack</span><span class='op'>::</span><span class='const'>Request</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
507
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_parse_json_body'>parse_json_body</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span><span class='rparen'>)</span>
506
508
  <span class='ivar'>@signature</span><span class='period'>.</span><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span>
507
- <span class='label'>params:</span> <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span>
509
+ <span class='label'>params:</span> <span class='id identifier rubyid_params'>params</span><span class='comma'>,</span>
508
510
  <span class='label'>verb:</span> <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_request_method'>request_method</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>get</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
509
511
  <span class='label'>path:</span> <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
510
512
  <span class='label'>signature:</span> <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>HTTP_X_SIGNATURE</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
@@ -521,7 +523,7 @@
521
523
  </div>
522
524
 
523
525
  <div id="footer">
524
- Generated on Wed Oct 12 11:55:54 2022 by
526
+ Generated on Mon Nov 14 18:18:15 2022 by
525
527
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
526
528
  0.9.28 (ruby-3.1.2).
527
529
  </div>
@@ -670,7 +670,7 @@
670
670
  </div>
671
671
 
672
672
  <div id="footer">
673
- Generated on Wed Oct 12 11:55:54 2022 by
673
+ Generated on Mon Nov 14 18:18:15 2022 by
674
674
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
675
675
  0.9.28 (ruby-3.1.2).
676
676
  </div>
@@ -137,7 +137,7 @@
137
137
  </div>
138
138
 
139
139
  <div id="footer">
140
- Generated on Wed Oct 12 11:55:54 2022 by
140
+ Generated on Mon Nov 14 18:18:15 2022 by
141
141
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
142
142
  0.9.28 (ruby-3.1.2).
143
143
  </div>
data/docs/M2mKeygen.html CHANGED
@@ -131,7 +131,7 @@
131
131
 
132
132
  </div>
133
133
  </dt>
134
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.4.3</span><span class='tstring_end'>&#39;</span></span></pre></dd>
134
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.4.5</span><span class='tstring_end'>&#39;</span></span></pre></dd>
135
135
 
136
136
  </dl>
137
137
 
@@ -147,7 +147,7 @@
147
147
  </div>
148
148
 
149
149
  <div id="footer">
150
- Generated on Wed Oct 12 11:55:54 2022 by
150
+ Generated on Mon Nov 14 18:18:15 2022 by
151
151
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
152
152
  0.9.28 (ruby-3.1.2).
153
153
  </div>
data/docs/_index.html CHANGED
@@ -172,7 +172,7 @@
172
172
  </div>
173
173
 
174
174
  <div id="footer">
175
- Generated on Wed Oct 12 11:55:54 2022 by
175
+ Generated on Mon Nov 14 18:18:15 2022 by
176
176
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
177
177
  0.9.28 (ruby-3.1.2).
178
178
  </div>
@@ -220,7 +220,7 @@ The receiver will generate the same signature from the HTTP request it has recei
220
220
  </div></div>
221
221
 
222
222
  <div id="footer">
223
- Generated on Wed Oct 12 11:55:54 2022 by
223
+ Generated on Mon Nov 14 18:18:15 2022 by
224
224
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
225
225
  0.9.28 (ruby-3.1.2).
226
226
  </div>
data/docs/index.html CHANGED
@@ -220,7 +220,7 @@ The receiver will generate the same signature from the HTTP request it has recei
220
220
  </div></div>
221
221
 
222
222
  <div id="footer">
223
- Generated on Wed Oct 12 11:55:54 2022 by
223
+ Generated on Mon Nov 14 18:18:15 2022 by
224
224
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
225
225
  0.9.28 (ruby-3.1.2).
226
226
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Wed Oct 12 11:55:54 2022 by
103
+ Generated on Mon Nov 14 18:18:15 2022 by
104
104
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.28 (ruby-3.1.2).
106
106
  </div>
@@ -22,13 +22,24 @@ module M2mKeygen
22
22
  def validate(req)
23
23
  # This will cover the case when Rails is used.
24
24
  req = Rack::Request.new(req.env)
25
+ params = (req.params || {}).merge(parse_json_body(req))
25
26
  @signature.validate(
26
- params: req.params || {},
27
+ params: params,
27
28
  verb: req.request_method || 'get',
28
29
  path: req.path || '/',
29
30
  signature: req.env['HTTP_X_SIGNATURE'] || '',
30
31
  ) && req.params['expiry'] && req.params['expiry'].to_i > Time.now.to_i &&
31
32
  req.params['expiry'].to_i < Time.now.to_i + 120
32
33
  end
34
+
35
+ private
36
+
37
+ sig { params(req: T.untyped).returns(T::Hash[T.untyped, T.untyped]) }
38
+ def parse_json_body(req)
39
+ body = req.body.read
40
+ JSON.parse(body || '{}')
41
+ rescue JSON::ParserError
42
+ {}
43
+ end
33
44
  end
34
45
  end
@@ -3,5 +3,5 @@
3
3
 
4
4
  module M2mKeygen
5
5
  # Gem version
6
- VERSION = '0.4.3'
6
+ VERSION = '0.4.5'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m2m_keygen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis <Zaratan> Pasin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-12 00:00:00.000000000 Z
11
+ date: 2022-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack