m2m_keygen 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +39 -40
- data/docs/M2mKeygen/Error.html +1 -1
- data/docs/M2mKeygen/ParamsEncoder.html +1 -1
- data/docs/M2mKeygen/RackValidator.html +2 -2
- data/docs/M2mKeygen/Signature.html +1 -1
- data/docs/M2mKeygen/Types.html +1 -1
- data/docs/M2mKeygen.html +2 -2
- data/docs/_index.html +1 -1
- data/docs/file.README.html +1 -1
- data/docs/index.html +1 -1
- data/docs/top-level-namespace.html +1 -1
- data/lib/m2m_keygen/rack_validator.rb +11 -1
- data/lib/m2m_keygen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe5f3c6619186af1bfe0e73e14d81a05b6f989456f10160ef89847909c77656
|
4
|
+
data.tar.gz: '09433e9b1ee7b908e90431ca806051485b262157c82e44e8d0c14eeddee897b9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69023221f541a8c3fbbb62c3d4477bebb83209e1a7dc736b29a402b6d3809394e828e82fcc160155590391646d38574ad26104e1ffedee941701474d49164ac9
|
7
|
+
data.tar.gz: f38aeafbaf8bd911b490c8d5a17bd8d3bb34f2051c022a4a2a832ac90c1fc8d8458bab8a5611f6aafbf0bde14b4f3726b9c8534f81c9725f6ea8438bc6d79d1d
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.4.4] - 2022-11-14
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Body is parsed as JSON and added to the query string
|
15
|
+
|
10
16
|
## [0.4.3] - 2022-10-12
|
11
17
|
|
12
18
|
### Changed
|
@@ -55,7 +61,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
55
61
|
|
56
62
|
- Basic skeleton for gem
|
57
63
|
|
58
|
-
[unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.
|
64
|
+
[unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.4...HEAD
|
65
|
+
[0.4.4]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.4
|
59
66
|
[0.4.3]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.3
|
60
67
|
[0.4.2]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.2
|
61
68
|
[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.
|
4
|
+
m2m_keygen (0.4.4)
|
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 (
|
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.
|
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.
|
70
|
+
nokogiri (1.13.9-arm64-darwin)
|
71
71
|
racc (~> 1.4)
|
72
|
-
nokogiri (1.13.
|
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 (
|
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.
|
113
|
-
rspec-core (~> 3.
|
114
|
-
rspec-expectations (~> 3.
|
115
|
-
rspec-mocks (~> 3.
|
116
|
-
rspec-core (3.
|
117
|
-
rspec-support (~> 3.
|
118
|
-
rspec-expectations (3.
|
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.
|
121
|
-
rspec-mocks (3.
|
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.
|
124
|
-
rspec-support (3.
|
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.
|
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.
|
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.
|
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.
|
172
|
-
sorbet-static (= 0.5.
|
173
|
-
sorbet-runtime (0.5.
|
174
|
-
sorbet-static (0.5.
|
175
|
-
sorbet-static (0.5.
|
176
|
-
sorbet-static-and-runtime (0.5.
|
177
|
-
sorbet (= 0.5.
|
178
|
-
sorbet-runtime (= 0.5.
|
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 (
|
184
|
-
prettier_print
|
185
|
-
syntax_tree-haml (
|
186
|
-
haml (>= 5.2)
|
187
|
-
prettier_print
|
188
|
-
syntax_tree (>=
|
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.
|
193
|
+
tapioca (0.10.3)
|
194
194
|
bundler (>= 1.17.3)
|
195
195
|
netrc (>= 0.11.0)
|
196
196
|
parallel (>= 1.21.0)
|
197
|
-
|
198
|
-
|
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.
|
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.
|
217
|
+
zeitwerk (2.6.6)
|
219
218
|
|
220
219
|
PLATFORMS
|
221
220
|
arm64-darwin-21
|
data/docs/M2mKeygen/Error.html
CHANGED
@@ -125,7 +125,7 @@
|
|
125
125
|
</div>
|
126
126
|
|
127
127
|
<div id="footer">
|
128
|
-
Generated on
|
128
|
+
Generated on Mon Nov 14 18:01:46 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
|
314
|
+
Generated on Mon Nov 14 18:01:46 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>
|
@@ -504,7 +504,7 @@
|
|
504
504
|
<span class='comment'># This will cover the case when Rails is used.
|
505
505
|
</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
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='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>
|
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>
|
508
508
|
<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'>'</span><span class='tstring_content'>get</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
509
509
|
<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'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
510
510
|
<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'>'</span><span class='tstring_content'>HTTP_X_SIGNATURE</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
@@ -521,7 +521,7 @@
|
|
521
521
|
</div>
|
522
522
|
|
523
523
|
<div id="footer">
|
524
|
-
Generated on
|
524
|
+
Generated on Mon Nov 14 18:01:46 2022 by
|
525
525
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
526
526
|
0.9.28 (ruby-3.1.2).
|
527
527
|
</div>
|
@@ -670,7 +670,7 @@
|
|
670
670
|
</div>
|
671
671
|
|
672
672
|
<div id="footer">
|
673
|
-
Generated on
|
673
|
+
Generated on Mon Nov 14 18:01:46 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>
|
data/docs/M2mKeygen/Types.html
CHANGED
@@ -137,7 +137,7 @@
|
|
137
137
|
</div>
|
138
138
|
|
139
139
|
<div id="footer">
|
140
|
-
Generated on
|
140
|
+
Generated on Mon Nov 14 18:01:46 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'>'</span><span class='tstring_content'>0.4.
|
134
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.4.4</span><span class='tstring_end'>'</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
|
150
|
+
Generated on Mon Nov 14 18:01:46 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
|
175
|
+
Generated on Mon Nov 14 18:01:46 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>
|
data/docs/file.README.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
|
223
|
+
Generated on Mon Nov 14 18:01:46 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
|
223
|
+
Generated on Mon Nov 14 18:01:46 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
|
103
|
+
Generated on Mon Nov 14 18:01:46 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>
|
@@ -23,12 +23,22 @@ module M2mKeygen
|
|
23
23
|
# This will cover the case when Rails is used.
|
24
24
|
req = Rack::Request.new(req.env)
|
25
25
|
@signature.validate(
|
26
|
-
params: req.params || {},
|
26
|
+
params: (req.params || {}).merge(parse_json_body(req)) || {},
|
27
27
|
verb: req.request_method || 'get',
|
28
28
|
path: req.path || '/',
|
29
29
|
signature: req.env['HTTP_X_SIGNATURE'] || '',
|
30
30
|
) && req.params['expiry'] && req.params['expiry'].to_i > Time.now.to_i &&
|
31
31
|
req.params['expiry'].to_i < Time.now.to_i + 120
|
32
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
sig { params(req: T.untyped).returns(T::Hash[T.untyped, T.untyped]) }
|
37
|
+
def parse_json_body(req)
|
38
|
+
body = req.body.read
|
39
|
+
JSON.parse(body || '{}')
|
40
|
+
rescue JSON::ParserError
|
41
|
+
{}
|
42
|
+
end
|
33
43
|
end
|
34
44
|
end
|
data/lib/m2m_keygen/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.4
|
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-
|
11
|
+
date: 2022-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|