m2m_keygen 0.4.4 → 0.4.6

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: 1fe5f3c6619186af1bfe0e73e14d81a05b6f989456f10160ef89847909c77656
4
- data.tar.gz: '09433e9b1ee7b908e90431ca806051485b262157c82e44e8d0c14eeddee897b9'
3
+ metadata.gz: 8d280c99b11ebb2f732abcafdaba6cab259a2be302a8a607fbbda10f5fe7abb0
4
+ data.tar.gz: 07f870bb4b47ad5fde79568fed001f45772a2f12a2b3602960490f338be82b3e
5
5
  SHA512:
6
- metadata.gz: 69023221f541a8c3fbbb62c3d4477bebb83209e1a7dc736b29a402b6d3809394e828e82fcc160155590391646d38574ad26104e1ffedee941701474d49164ac9
7
- data.tar.gz: f38aeafbaf8bd911b490c8d5a17bd8d3bb34f2051c022a4a2a832ac90c1fc8d8458bab8a5611f6aafbf0bde14b4f3726b9c8534f81c9725f6ea8438bc6d79d1d
6
+ metadata.gz: dca5069e662ce7699987c338c5acf7c01ca0d2598732a2bb3615f14240e374d78bc8308bc65c1ac9f3d35fcbb31302b4cd9a38243eb53dbaaa0a30a1d6c3435d
7
+ data.tar.gz: d6b584feb7c20a823b77f30d1e8c6b941b1a8d8f56ad057a42b99756b2872e540dabdf2abe90cb15036d14f9d1af91a0cc3ee0e5e9bce7b8b7555b849594ec3e
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.6] - 2022-11-14
11
+
12
+ ### Fixed
13
+
14
+ - Expiry can be part of JSON body
15
+
16
+ ## [0.4.5] - 2022-11-14
17
+
18
+ ### Fixed
19
+
20
+ - Expiry can be part of JSON body
21
+
10
22
  ## [0.4.4] - 2022-11-14
11
23
 
12
24
  ### Changed
@@ -61,7 +73,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
61
73
 
62
74
  - Basic skeleton for gem
63
75
 
64
- [unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.4...HEAD
76
+ [unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.6...HEAD
77
+ [0.4.6]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.6
78
+ [0.4.5]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.5
65
79
  [0.4.4]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.4
66
80
  [0.4.3]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.3
67
81
  [0.4.2]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- m2m_keygen (0.4.4)
4
+ m2m_keygen (0.4.6)
5
5
  rack
6
6
  sorbet-runtime
7
7
  zeitwerk (~> 2.6)
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Mon Nov 14 18:01:46 2022 by
128
+ Generated on Mon Nov 14 18:31:35 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 Mon Nov 14 18:01:46 2022 by
314
+ Generated on Mon Nov 14 18:31:35 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,13 +504,14 @@
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>
506
- <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='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> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</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>
508
+ <span class='op'>!</span><span class='op'>!</span><span class='ivar'>@signature</span><span class='period'>.</span><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</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>
511
- <span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expiry</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expiry</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>&amp;&amp;</span>
512
- <span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expiry</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>&lt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>+</span> <span class='int'>120</span>
513
+ <span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expiry</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expiry</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>&amp;&amp;</span>
514
+ <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expiry</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>&lt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>+</span> <span class='int'>120</span>
513
515
  <span class='kw'>end</span></pre>
514
516
  </td>
515
517
  </tr>
@@ -521,7 +523,7 @@
521
523
  </div>
522
524
 
523
525
  <div id="footer">
524
- Generated on Mon Nov 14 18:01:46 2022 by
526
+ Generated on Mon Nov 14 18:31:35 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 Mon Nov 14 18:01:46 2022 by
673
+ Generated on Mon Nov 14 18:31:35 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 Mon Nov 14 18:01:46 2022 by
140
+ Generated on Mon Nov 14 18:31:35 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.4</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.6</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 Mon Nov 14 18:01:46 2022 by
150
+ Generated on Mon Nov 14 18:31:35 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 Mon Nov 14 18:01:46 2022 by
175
+ Generated on Mon Nov 14 18:31:34 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 Mon Nov 14 18:01:46 2022 by
223
+ Generated on Mon Nov 14 18:31:34 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 Mon Nov 14 18:01:46 2022 by
223
+ Generated on Mon Nov 14 18:31:34 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 Mon Nov 14 18:01:46 2022 by
103
+ Generated on Mon Nov 14 18:31:34 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,14 @@ 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
- @signature.validate(
26
- params: (req.params || {}).merge(parse_json_body(req)) || {},
25
+ params = (req.params || {}).merge(parse_json_body(req))
26
+ !!@signature.validate(
27
+ params: params,
27
28
  verb: req.request_method || 'get',
28
29
  path: req.path || '/',
29
30
  signature: req.env['HTTP_X_SIGNATURE'] || '',
30
- ) && req.params['expiry'] && req.params['expiry'].to_i > Time.now.to_i &&
31
- req.params['expiry'].to_i < Time.now.to_i + 120
31
+ ) && params['expiry'] && params['expiry'].to_i > Time.now.to_i &&
32
+ params['expiry'].to_i < Time.now.to_i + 120
32
33
  end
33
34
 
34
35
  private
@@ -3,5 +3,5 @@
3
3
 
4
4
  module M2mKeygen
5
5
  # Gem version
6
- VERSION = '0.4.4'
6
+ VERSION = '0.4.6'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m2m_keygen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis <Zaratan> Pasin