m2m_keygen 0.3.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -4
- data/Gemfile.lock +3 -1
- data/README.md +30 -0
- data/docs/M2mKeygen/Error.html +1 -1
- data/docs/M2mKeygen/ParamsEncoder.html +1 -1
- data/docs/M2mKeygen/RackValidator.html +531 -0
- data/docs/M2mKeygen/Signature.html +2 -2
- data/docs/M2mKeygen/Types.html +1 -1
- data/docs/M2mKeygen.html +4 -4
- data/docs/_index.html +16 -1
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +33 -1
- data/docs/index.html +33 -1
- data/docs/method_list.html +32 -0
- data/docs/top-level-namespace.html +1 -1
- data/lib/m2m_keygen/rack_validator.rb +34 -0
- data/lib/m2m_keygen/signature.rb +1 -1
- data/lib/m2m_keygen/version.rb +1 -1
- data/m2m_keygen.gemspec +1 -0
- data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +24 -0
- data/sorbet/rbi/gems/rack@2.2.4.rbi +5630 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +3 -5
- data/sorbet/rbi/gems/yard@0.9.28.rbi +124 -0
- metadata +19 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 385c9b5cec4581c958eda9972cb0c0d1c6015cf8ec39670ce6667dcefde15839
|
|
4
|
+
data.tar.gz: bf3bd3d11bd3a58f501d808c70123519719f5fe26a294e6363d7637f198e6106
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ca255f2052ba656a11311a4dd1532e8761dd53874db90a64c603159a7c080a64733f7e299e15bb8d482972b333ff58b09f7d62d9303263a05c6c87063029503
|
|
7
|
+
data.tar.gz: 764986a41b42fdefb8d0b83ebfaf51e6f2c0d70c6e34290afc919d2442cf51dd86e23f5450dc2ee6045f8c15d7f55824d0081b09ed379855bad2e739cc6efa16
|
data/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [0.
|
|
10
|
+
## [0.4.2] - 2022-09-05
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Request default value for params in RackValidator
|
|
15
|
+
|
|
16
|
+
## [0.4.1] - 2022-09-05
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Loosening RackValidator initialize type.
|
|
21
|
+
|
|
22
|
+
## [0.4.0] - 2022-08-30
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Direct validation for `Rack::Request` like objects.
|
|
27
|
+
|
|
28
|
+
## [0.3.0] - 2022-08-30
|
|
11
29
|
|
|
12
30
|
### Added
|
|
13
31
|
|
|
@@ -19,19 +37,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
37
|
- Comprehensive README
|
|
20
38
|
- Added various minimal require
|
|
21
39
|
|
|
22
|
-
## [0.2.1]
|
|
40
|
+
## [0.2.1] - 2022-08-29
|
|
23
41
|
|
|
24
42
|
### Added
|
|
25
43
|
|
|
26
44
|
- Good link to documentation
|
|
27
45
|
|
|
28
|
-
## [0.2.0]
|
|
46
|
+
## [0.2.0] - 2022-08-29
|
|
29
47
|
|
|
30
48
|
### Added
|
|
31
49
|
|
|
32
50
|
- Basic skeleton for gem
|
|
33
51
|
|
|
34
|
-
[unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.
|
|
52
|
+
[unreleased]: https://github.com/Billcorporate/m2m_keygen_ruby/compare/v0.4.0...HEAD
|
|
53
|
+
[0.4.0]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.4.0
|
|
35
54
|
[0.3.0]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.3.0
|
|
36
55
|
[0.2.1]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.2.1
|
|
37
56
|
[0.2.0]: https://github.com/Billcorporate/m2m_keygen_ruby/releases/tag/v0.2.0
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
m2m_keygen (0.
|
|
4
|
+
m2m_keygen (0.4.2)
|
|
5
|
+
rack
|
|
5
6
|
sorbet-runtime
|
|
6
7
|
zeitwerk (~> 2.6)
|
|
7
8
|
|
|
@@ -91,6 +92,7 @@ GEM
|
|
|
91
92
|
byebug (~> 11.0)
|
|
92
93
|
pry (>= 0.13, < 0.15)
|
|
93
94
|
racc (1.6.0)
|
|
95
|
+
rack (2.2.4)
|
|
94
96
|
rainbow (3.1.1)
|
|
95
97
|
rake (13.0.6)
|
|
96
98
|
rb-fsevent (0.11.2)
|
data/README.md
CHANGED
|
@@ -81,6 +81,36 @@ AuthSignature.validate(
|
|
|
81
81
|
|
|
82
82
|
If the validation is true, the request was signed with the same algorithm and same secret key.
|
|
83
83
|
|
|
84
|
+
### RackValidator
|
|
85
|
+
|
|
86
|
+
This module is here for directly validate Rack requests.
|
|
87
|
+
|
|
88
|
+
It will validate :
|
|
89
|
+
|
|
90
|
+
- Signature matching
|
|
91
|
+
- That the `expiry` parameter is present and between now and in 2 minutes.
|
|
92
|
+
|
|
93
|
+
#### Initialization
|
|
94
|
+
|
|
95
|
+
You should initialize the `RackValidator` once (in an initializer for example) with your secret key, eventually an encryption algorithm and a header name for the signature.
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
RackSignatureValidator =
|
|
99
|
+
M2mKeygen::RackValidator.new(
|
|
100
|
+
"secret",
|
|
101
|
+
algorithm: "sha512", # Default value
|
|
102
|
+
header_name: "X-Signature" # Default value
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Validation
|
|
107
|
+
|
|
108
|
+
You can then validate a Rack::Request or a Rails Request directly:
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
RackSignatureValidator.validate(request) # => true or false
|
|
112
|
+
```
|
|
113
|
+
|
|
84
114
|
## How does it works
|
|
85
115
|
|
|
86
116
|
This is intended for a secure discussion between 2 servers and not something in a browser as the secret key must be stored and used both side (and you don't want to send the secret key in the browser).
|
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 Sep 5 14:55:58 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 Sep 5 14:55:58 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>
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Class: M2mKeygen::RackValidator
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.28
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
pathId = "M2mKeygen::RackValidator";
|
|
19
|
+
relpath = '../';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="../_index.html">Index (R)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../M2mKeygen.html" title="M2mKeygen (module)">M2mKeygen</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">RackValidator</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="../class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Class: M2mKeygen::RackValidator
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
<dl>
|
|
70
|
+
<dt>Inherits:</dt>
|
|
71
|
+
<dd>
|
|
72
|
+
<span class="inheritName">Object</span>
|
|
73
|
+
|
|
74
|
+
<ul class="fullTree">
|
|
75
|
+
<li>Object</li>
|
|
76
|
+
|
|
77
|
+
<li class="next">M2mKeygen::RackValidator</li>
|
|
78
|
+
|
|
79
|
+
</ul>
|
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
81
|
+
|
|
82
|
+
</dd>
|
|
83
|
+
</dl>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<dl>
|
|
89
|
+
<dt>Extended by:</dt>
|
|
90
|
+
<dd>T::Sig</dd>
|
|
91
|
+
</dl>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<dl>
|
|
101
|
+
<dt>Defined in:</dt>
|
|
102
|
+
<dd>lib/m2m_keygen/rack_validator.rb</dd>
|
|
103
|
+
</dl>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
112
|
+
<ul class="summary">
|
|
113
|
+
|
|
114
|
+
<li class="public ">
|
|
115
|
+
<span class="summary_signature">
|
|
116
|
+
|
|
117
|
+
<a href="#header_name-instance_method" title="#header_name (instance method)">#<strong>header_name</strong> ⇒ String </a>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
</span>
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<span class="note title readonly">readonly</span>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
137
|
+
|
|
138
|
+
</li>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<li class="public ">
|
|
142
|
+
<span class="summary_signature">
|
|
143
|
+
|
|
144
|
+
<a href="#signature-instance_method" title="#signature (instance method)">#<strong>signature</strong> ⇒ Signature </a>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
</span>
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
<span class="note title readonly">readonly</span>
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
164
|
+
|
|
165
|
+
</li>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
</ul>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
<h2>
|
|
175
|
+
Instance Method Summary
|
|
176
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
177
|
+
</h2>
|
|
178
|
+
|
|
179
|
+
<ul class="summary">
|
|
180
|
+
|
|
181
|
+
<li class="public ">
|
|
182
|
+
<span class="summary_signature">
|
|
183
|
+
|
|
184
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(secret, algorithm: "sha512", header_name: "X-Signature") ⇒ void </a>
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
</span>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<span class="note title constructor">constructor</span>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
201
|
+
|
|
202
|
+
</li>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
<li class="public ">
|
|
206
|
+
<span class="summary_signature">
|
|
207
|
+
|
|
208
|
+
<a href="#validate-instance_method" title="#validate (instance method)">#<strong>validate</strong>(req) ⇒ Boolean </a>
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
</span>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
223
|
+
|
|
224
|
+
</li>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
</ul>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<div id="constructor_details" class="method_details_list">
|
|
232
|
+
<h2>Constructor Details</h2>
|
|
233
|
+
|
|
234
|
+
<div class="method_details first">
|
|
235
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
236
|
+
|
|
237
|
+
#<strong>initialize</strong>(secret, algorithm: "sha512", header_name: "X-Signature") ⇒ <tt>void</tt>
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
</h3><div class="docstring">
|
|
244
|
+
<div class="discussion">
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="tags">
|
|
250
|
+
<p class="tag_title">Parameters:</p>
|
|
251
|
+
<ul class="param">
|
|
252
|
+
|
|
253
|
+
<li>
|
|
254
|
+
|
|
255
|
+
<span class='name'>secret</span>
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
</li>
|
|
263
|
+
|
|
264
|
+
<li>
|
|
265
|
+
|
|
266
|
+
<span class='name'>algorithm</span>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
<em class="default">(defaults to: <tt>"sha512"</tt>)</em>
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
</li>
|
|
276
|
+
|
|
277
|
+
<li>
|
|
278
|
+
|
|
279
|
+
<span class='name'>header_name</span>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<em class="default">(defaults to: <tt>"X-Signature"</tt>)</em>
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
</li>
|
|
289
|
+
|
|
290
|
+
</ul>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
</div><table class="source_code">
|
|
294
|
+
<tr>
|
|
295
|
+
<td>
|
|
296
|
+
<pre class="lines">
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
16
|
|
300
|
+
17
|
|
301
|
+
18
|
|
302
|
+
19</pre>
|
|
303
|
+
</td>
|
|
304
|
+
<td>
|
|
305
|
+
<pre class="code"><span class="info file"># File 'lib/m2m_keygen/rack_validator.rb', line 16</span>
|
|
306
|
+
|
|
307
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_secret'>secret</span><span class='comma'>,</span> <span class='label'>algorithm:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>sha512</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>header_name:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>X-Signature</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
308
|
+
<span class='ivar'>@header_name</span> <span class='op'>=</span> <span class='const'>T</span><span class='period'>.</span><span class='id identifier rubyid_let'>let</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>HTTP_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_header_name'>header_name</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='const'>String</span><span class='rparen'>)</span>
|
|
309
|
+
<span class='ivar'>@signature</span> <span class='op'>=</span> <span class='const'>T</span><span class='period'>.</span><span class='id identifier rubyid_let'>let</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Signature.html" title="M2mKeygen::Signature (class)">Signature</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Signature.html#initialize-instance_method" title="M2mKeygen::Signature#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_secret'>secret</span><span class='comma'>,</span> <span class='label'>algorithm:</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Signature.html" title="M2mKeygen::Signature (class)">Signature</a></span></span><span class='rparen'>)</span>
|
|
310
|
+
<span class='kw'>end</span></pre>
|
|
311
|
+
</td>
|
|
312
|
+
</tr>
|
|
313
|
+
</table>
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
<div id="instance_attr_details" class="attr_details">
|
|
319
|
+
<h2>Instance Attribute Details</h2>
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<span id=""></span>
|
|
323
|
+
<div class="method_details first">
|
|
324
|
+
<h3 class="signature first" id="header_name-instance_method">
|
|
325
|
+
|
|
326
|
+
#<strong>header_name</strong> ⇒ <tt>String</tt> <span class="extras">(readonly)</span>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
</h3><div class="docstring">
|
|
333
|
+
<div class="discussion">
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
<div class="tags">
|
|
339
|
+
|
|
340
|
+
<p class="tag_title">Returns:</p>
|
|
341
|
+
<ul class="return">
|
|
342
|
+
|
|
343
|
+
<li>
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
</li>
|
|
351
|
+
|
|
352
|
+
</ul>
|
|
353
|
+
|
|
354
|
+
</div><table class="source_code">
|
|
355
|
+
<tr>
|
|
356
|
+
<td>
|
|
357
|
+
<pre class="lines">
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
13
|
|
361
|
+
14
|
|
362
|
+
15</pre>
|
|
363
|
+
</td>
|
|
364
|
+
<td>
|
|
365
|
+
<pre class="code"><span class="info file"># File 'lib/m2m_keygen/rack_validator.rb', line 13</span>
|
|
366
|
+
|
|
367
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_header_name'>header_name</span>
|
|
368
|
+
<span class='ivar'>@header_name</span>
|
|
369
|
+
<span class='kw'>end</span></pre>
|
|
370
|
+
</td>
|
|
371
|
+
</tr>
|
|
372
|
+
</table>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
<span id=""></span>
|
|
377
|
+
<div class="method_details ">
|
|
378
|
+
<h3 class="signature " id="signature-instance_method">
|
|
379
|
+
|
|
380
|
+
#<strong>signature</strong> ⇒ <tt><span class='object_link'><a href="Signature.html" title="M2mKeygen::Signature (class)">Signature</a></span></tt> <span class="extras">(readonly)</span>
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
</h3><div class="docstring">
|
|
387
|
+
<div class="discussion">
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
<div class="tags">
|
|
393
|
+
|
|
394
|
+
<p class="tag_title">Returns:</p>
|
|
395
|
+
<ul class="return">
|
|
396
|
+
|
|
397
|
+
<li>
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
<span class='type'>(<tt><span class='object_link'><a href="Signature.html" title="M2mKeygen::Signature (class)">Signature</a></span></tt>)</span>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
</li>
|
|
405
|
+
|
|
406
|
+
</ul>
|
|
407
|
+
|
|
408
|
+
</div><table class="source_code">
|
|
409
|
+
<tr>
|
|
410
|
+
<td>
|
|
411
|
+
<pre class="lines">
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
10
|
|
415
|
+
11
|
|
416
|
+
12</pre>
|
|
417
|
+
</td>
|
|
418
|
+
<td>
|
|
419
|
+
<pre class="code"><span class="info file"># File 'lib/m2m_keygen/rack_validator.rb', line 10</span>
|
|
420
|
+
|
|
421
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_signature'>signature</span>
|
|
422
|
+
<span class='ivar'>@signature</span>
|
|
423
|
+
<span class='kw'>end</span></pre>
|
|
424
|
+
</td>
|
|
425
|
+
</tr>
|
|
426
|
+
</table>
|
|
427
|
+
</div>
|
|
428
|
+
|
|
429
|
+
</div>
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
<div id="instance_method_details" class="method_details_list">
|
|
433
|
+
<h2>Instance Method Details</h2>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
<div class="method_details first">
|
|
437
|
+
<h3 class="signature first" id="validate-instance_method">
|
|
438
|
+
|
|
439
|
+
#<strong>validate</strong>(req) ⇒ <tt>Boolean</tt>
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
</h3><div class="docstring">
|
|
446
|
+
<div class="discussion">
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
</div>
|
|
450
|
+
</div>
|
|
451
|
+
<div class="tags">
|
|
452
|
+
<p class="tag_title">Parameters:</p>
|
|
453
|
+
<ul class="param">
|
|
454
|
+
|
|
455
|
+
<li>
|
|
456
|
+
|
|
457
|
+
<span class='name'>req</span>
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
<span class='type'>(<tt>T.untyped</tt>)</span>
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
</li>
|
|
465
|
+
|
|
466
|
+
</ul>
|
|
467
|
+
|
|
468
|
+
<p class="tag_title">Returns:</p>
|
|
469
|
+
<ul class="return">
|
|
470
|
+
|
|
471
|
+
<li>
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
</li>
|
|
479
|
+
|
|
480
|
+
</ul>
|
|
481
|
+
|
|
482
|
+
</div><table class="source_code">
|
|
483
|
+
<tr>
|
|
484
|
+
<td>
|
|
485
|
+
<pre class="lines">
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
22
|
|
489
|
+
23
|
|
490
|
+
24
|
|
491
|
+
25
|
|
492
|
+
26
|
|
493
|
+
27
|
|
494
|
+
28
|
|
495
|
+
29
|
|
496
|
+
30
|
|
497
|
+
31
|
|
498
|
+
32</pre>
|
|
499
|
+
</td>
|
|
500
|
+
<td>
|
|
501
|
+
<pre class="code"><span class="info file"># File 'lib/m2m_keygen/rack_validator.rb', line 22</span>
|
|
502
|
+
|
|
503
|
+
<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
|
+
<span class='comment'># This will cover the case when Rails is used.
|
|
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
|
+
<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>
|
|
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
|
+
<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
|
+
<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>
|
|
511
|
+
<span class='rparen'>)</span> <span class='op'>&&</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'>"</span><span class='tstring_content'>expiry</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>&&</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'>"</span><span class='tstring_content'>expiry</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>></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>
|
|
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'>"</span><span class='tstring_content'>expiry</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'><</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='kw'>end</span></pre>
|
|
514
|
+
</td>
|
|
515
|
+
</tr>
|
|
516
|
+
</table>
|
|
517
|
+
</div>
|
|
518
|
+
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
</div>
|
|
522
|
+
|
|
523
|
+
<div id="footer">
|
|
524
|
+
Generated on Mon Sep 5 14:55:58 2022 by
|
|
525
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
526
|
+
0.9.28 (ruby-3.1.2).
|
|
527
|
+
</div>
|
|
528
|
+
|
|
529
|
+
</div>
|
|
530
|
+
</body>
|
|
531
|
+
</html>
|