truelayer-signing 0.1.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +12 -2
  4. data/examples/webhook-server/Gemfile +1 -0
  5. data/examples/webhook-server/Gemfile.lock +28 -3
  6. data/examples/webhook-server/main.rb +15 -14
  7. data/lib/truelayer-signing/jwt.rb +1 -1
  8. data/lib/truelayer-signing/signer.rb +3 -0
  9. data/lib/truelayer-signing/utils.rb +8 -1
  10. data/lib/truelayer-signing/verifier.rb +80 -20
  11. data/lib/truelayer-signing.rb +9 -1
  12. data/test/resources/failed-payment-expired-test-payload.json +12 -0
  13. data/test/resources/missing-zero-padding-test-jwks.json +19 -0
  14. data/test/resources/missing-zero-padding-test-payload.json +22 -0
  15. data/test/resources/missing-zero-padding-test-signature.txt +1 -0
  16. data/test/test-truelayer-signing.rb +141 -7
  17. data/truelayer-signing.gemspec +2 -2
  18. metadata +10 -75
  19. data/doc/CHANGELOG_md.html +0 -132
  20. data/doc/JWT/Decode.html +0 -97
  21. data/doc/JWT/Encode.html +0 -97
  22. data/doc/JWT/JWK/EC.html +0 -169
  23. data/doc/JWT/JWK.html +0 -91
  24. data/doc/JWT.html +0 -95
  25. data/doc/LICENSE-APACHE.html +0 -177
  26. data/doc/LICENSE-MIT.html +0 -105
  27. data/doc/README_md.html +0 -197
  28. data/doc/Rakefile.html +0 -106
  29. data/doc/TrueLayerSigning/Config.html +0 -211
  30. data/doc/TrueLayerSigning/Error.html +0 -97
  31. data/doc/TrueLayerSigning/JwsBase.html +0 -317
  32. data/doc/TrueLayerSigning/JwsHeader.html +0 -268
  33. data/doc/TrueLayerSigning/Signer.html +0 -186
  34. data/doc/TrueLayerSigning/Verifier.html +0 -327
  35. data/doc/TrueLayerSigning.html +0 -226
  36. data/doc/TrueLayerSigningExamples.html +0 -217
  37. data/doc/created.rid +0 -21
  38. data/doc/css/fonts.css +0 -167
  39. data/doc/css/rdoc.css +0 -662
  40. data/doc/examples/sign-request/Gemfile.html +0 -99
  41. data/doc/examples/sign-request/Gemfile_lock.html +0 -143
  42. data/doc/examples/sign-request/README_md.html +0 -138
  43. data/doc/examples/webhook-server/Gemfile.html +0 -99
  44. data/doc/examples/webhook-server/Gemfile_lock.html +0 -142
  45. data/doc/examples/webhook-server/README_md.html +0 -139
  46. data/doc/fonts/Lato-Light.ttf +0 -0
  47. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  48. data/doc/fonts/Lato-Regular.ttf +0 -0
  49. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  50. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  51. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  52. data/doc/images/add.png +0 -0
  53. data/doc/images/arrow_up.png +0 -0
  54. data/doc/images/brick.png +0 -0
  55. data/doc/images/brick_link.png +0 -0
  56. data/doc/images/bug.png +0 -0
  57. data/doc/images/bullet_black.png +0 -0
  58. data/doc/images/bullet_toggle_minus.png +0 -0
  59. data/doc/images/bullet_toggle_plus.png +0 -0
  60. data/doc/images/date.png +0 -0
  61. data/doc/images/delete.png +0 -0
  62. data/doc/images/find.png +0 -0
  63. data/doc/images/loadingAnimation.gif +0 -0
  64. data/doc/images/macFFBgHack.png +0 -0
  65. data/doc/images/package.png +0 -0
  66. data/doc/images/page_green.png +0 -0
  67. data/doc/images/page_white_text.png +0 -0
  68. data/doc/images/page_white_width.png +0 -0
  69. data/doc/images/plugin.png +0 -0
  70. data/doc/images/ruby.png +0 -0
  71. data/doc/images/tag_blue.png +0 -0
  72. data/doc/images/tag_green.png +0 -0
  73. data/doc/images/transparent.png +0 -0
  74. data/doc/images/wrench.png +0 -0
  75. data/doc/images/wrench_orange.png +0 -0
  76. data/doc/images/zoom.png +0 -0
  77. data/doc/index.html +0 -118
  78. data/doc/js/darkfish.js +0 -84
  79. data/doc/js/navigation.js +0 -105
  80. data/doc/js/navigation.js.gz +0 -0
  81. data/doc/js/search.js +0 -110
  82. data/doc/js/search_index.js +0 -1
  83. data/doc/js/search_index.js.gz +0 -0
  84. data/doc/js/searcher.js +0 -229
  85. data/doc/js/searcher.js.gz +0 -0
  86. data/doc/table_of_contents.html +0 -269
  87. data/examples/sign-request/Gemfile.lock +0 -40
@@ -1,317 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class TrueLayerSigning::JwsBase - RDoc Documentation</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- var index_rel_prefix = "../";
12
- </script>
13
-
14
- <script src="../js/navigation.js" defer></script>
15
- <script src="../js/search.js" defer></script>
16
- <script src="../js/search_index.js" defer></script>
17
- <script src="../js/searcher.js" defer></script>
18
- <script src="../js/darkfish.js" defer></script>
19
-
20
- <link href="../css/fonts.css" rel="stylesheet">
21
- <link href="../css/rdoc.css" rel="stylesheet">
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="../index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="../table_of_contents.html#pages">Pages</a>
34
- <a href="../table_of_contents.html#classes">Classes</a>
35
- <a href="../table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
-
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search" spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
47
-
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
53
-
54
- </div>
55
-
56
-
57
-
58
- <div id="class-metadata">
59
-
60
-
61
- <div id="parent-class-section" class="nav-section">
62
- <h3>Parent</h3>
63
-
64
- <p class="link">Object
65
- </div>
66
-
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <div id="method-list-section" class="nav-section">
72
- <h3>Methods</h3>
73
-
74
- <ul class="link-list" role="directory">
75
- <li ><a href="#method-c-new">::new</a>
76
- <li ><a href="#method-i-add_header">#add_header</a>
77
- <li ><a href="#method-i-set_body">#set_body</a>
78
- <li ><a href="#method-i-set_headers">#set_headers</a>
79
- <li ><a href="#method-i-set_method">#set_method</a>
80
- <li ><a href="#method-i-set_path">#set_path</a>
81
- </ul>
82
- </div>
83
-
84
- </div>
85
- </nav>
86
-
87
- <main role="main" aria-labelledby="class-TrueLayerSigning::JwsBase">
88
- <h1 id="class-TrueLayerSigning::JwsBase" class="class">
89
- class TrueLayerSigning::JwsBase
90
- </h1>
91
-
92
- <section class="description">
93
-
94
- </section>
95
-
96
- <section id="5Buntitled-5D" class="documentation-section">
97
-
98
-
99
-
100
- <section class="attribute-method-details" class="method-section">
101
- <header>
102
- <h3>Attributes</h3>
103
- </header>
104
-
105
- <div id="attribute-i-body" class="method-detail">
106
- <div class="method-heading attribute-method-heading">
107
- <span class="method-name">body</span><span
108
- class="attribute-access-type">[R]</span>
109
- </div>
110
-
111
- <div class="method-description">
112
-
113
- </div>
114
- </div>
115
- <div id="attribute-i-headers" class="method-detail">
116
- <div class="method-heading attribute-method-heading">
117
- <span class="method-name">headers</span><span
118
- class="attribute-access-type">[R]</span>
119
- </div>
120
-
121
- <div class="method-description">
122
-
123
- </div>
124
- </div>
125
- <div id="attribute-i-method" class="method-detail">
126
- <div class="method-heading attribute-method-heading">
127
- <span class="method-name">method</span><span
128
- class="attribute-access-type">[R]</span>
129
- </div>
130
-
131
- <div class="method-description">
132
-
133
- </div>
134
- </div>
135
- <div id="attribute-i-path" class="method-detail">
136
- <div class="method-heading attribute-method-heading">
137
- <span class="method-name">path</span><span
138
- class="attribute-access-type">[R]</span>
139
- </div>
140
-
141
- <div class="method-description">
142
-
143
- </div>
144
- </div>
145
- </section>
146
-
147
-
148
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
149
- <header>
150
- <h3>Public Class Methods</h3>
151
- </header>
152
-
153
- <div id="method-c-new" class="method-detail ">
154
- <div class="method-header">
155
- <div class="method-heading">
156
- <span class="method-name">new</span><span
157
- class="method-args">(args = {})</span>
158
- <span class="method-click-advice">click to toggle source</span>
159
- </div>
160
- </div>
161
-
162
- <div class="method-description">
163
-
164
-
165
- <div class="method-source-code" id="new-source">
166
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 46</span>
167
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">args</span> = {})
168
- <span class="ruby-ivar">@method</span> = <span class="ruby-string">&quot;POST&quot;</span>
169
- <span class="ruby-ivar">@headers</span> = {}
170
- <span class="ruby-keyword">end</span></pre>
171
- </div>
172
- </div>
173
-
174
-
175
- </div>
176
-
177
- </section>
178
-
179
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
180
- <header>
181
- <h3>Public Instance Methods</h3>
182
- </header>
183
-
184
- <div id="method-i-add_header" class="method-detail ">
185
- <div class="method-header">
186
- <div class="method-heading">
187
- <span class="method-name">add_header</span><span
188
- class="method-args">(name, value)</span>
189
- <span class="method-click-advice">click to toggle source</span>
190
- </div>
191
- </div>
192
-
193
- <div class="method-description">
194
-
195
-
196
- <div class="method-source-code" id="add_header-source">
197
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 63</span>
198
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_header</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
199
- <span class="ruby-ivar">@headers</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span>
200
- <span class="ruby-keyword">self</span>
201
- <span class="ruby-keyword">end</span></pre>
202
- </div>
203
- </div>
204
-
205
-
206
- </div>
207
-
208
- <div id="method-i-set_body" class="method-detail ">
209
- <div class="method-header">
210
- <div class="method-heading">
211
- <span class="method-name">set_body</span><span
212
- class="method-args">(body)</span>
213
- <span class="method-click-advice">click to toggle source</span>
214
- </div>
215
- </div>
216
-
217
- <div class="method-description">
218
-
219
-
220
- <div class="method-source-code" id="set_body-source">
221
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 73</span>
222
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_body</span>(<span class="ruby-identifier">body</span>)
223
- <span class="ruby-ivar">@body</span> = <span class="ruby-identifier">body</span>
224
- <span class="ruby-keyword">self</span>
225
- <span class="ruby-keyword">end</span></pre>
226
- </div>
227
- </div>
228
-
229
-
230
- </div>
231
-
232
- <div id="method-i-set_headers" class="method-detail ">
233
- <div class="method-header">
234
- <div class="method-heading">
235
- <span class="method-name">set_headers</span><span
236
- class="method-args">(headers)</span>
237
- <span class="method-click-advice">click to toggle source</span>
238
- </div>
239
- </div>
240
-
241
- <div class="method-description">
242
-
243
-
244
- <div class="method-source-code" id="set_headers-source">
245
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 68</span>
246
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_headers</span>(<span class="ruby-identifier">headers</span>)
247
- <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@headers</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span> }
248
- <span class="ruby-keyword">self</span>
249
- <span class="ruby-keyword">end</span></pre>
250
- </div>
251
- </div>
252
-
253
-
254
- </div>
255
-
256
- <div id="method-i-set_method" class="method-detail ">
257
- <div class="method-header">
258
- <div class="method-heading">
259
- <span class="method-name">set_method</span><span
260
- class="method-args">(method)</span>
261
- <span class="method-click-advice">click to toggle source</span>
262
- </div>
263
- </div>
264
-
265
- <div class="method-description">
266
-
267
-
268
- <div class="method-source-code" id="set_method-source">
269
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 51</span>
270
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_method</span>(<span class="ruby-identifier">method</span>)
271
- <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
272
- <span class="ruby-keyword">self</span>
273
- <span class="ruby-keyword">end</span></pre>
274
- </div>
275
- </div>
276
-
277
-
278
- </div>
279
-
280
- <div id="method-i-set_path" class="method-detail ">
281
- <div class="method-header">
282
- <div class="method-heading">
283
- <span class="method-name">set_path</span><span
284
- class="method-args">(path)</span>
285
- <span class="method-click-advice">click to toggle source</span>
286
- </div>
287
- </div>
288
-
289
- <div class="method-description">
290
-
291
-
292
- <div class="method-source-code" id="set_path-source">
293
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 56</span>
294
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_path</span>(<span class="ruby-identifier">path</span>)
295
- <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Error</span>, <span class="ruby-string">&quot;Path must start with &#39;/&#39;&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-string">&quot;/&quot;</span>)
296
-
297
- <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
298
- <span class="ruby-keyword">self</span>
299
- <span class="ruby-keyword">end</span></pre>
300
- </div>
301
- </div>
302
-
303
-
304
- </div>
305
-
306
- </section>
307
-
308
- </section>
309
- </main>
310
-
311
-
312
- <footer id="validator-badges" role="contentinfo">
313
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
314
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.5.0.
315
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
316
- </footer>
317
-
@@ -1,268 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class TrueLayerSigning::JwsHeader - RDoc Documentation</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- var index_rel_prefix = "../";
12
- </script>
13
-
14
- <script src="../js/navigation.js" defer></script>
15
- <script src="../js/search.js" defer></script>
16
- <script src="../js/search_index.js" defer></script>
17
- <script src="../js/searcher.js" defer></script>
18
- <script src="../js/darkfish.js" defer></script>
19
-
20
- <link href="../css/fonts.css" rel="stylesheet">
21
- <link href="../css/rdoc.css" rel="stylesheet">
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="../index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="../table_of_contents.html#pages">Pages</a>
34
- <a href="../table_of_contents.html#classes">Classes</a>
35
- <a href="../table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
-
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search" spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
47
-
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
53
-
54
- </div>
55
-
56
-
57
-
58
- <div id="class-metadata">
59
-
60
-
61
- <div id="parent-class-section" class="nav-section">
62
- <h3>Parent</h3>
63
-
64
- <p class="link">Object
65
- </div>
66
-
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <div id="method-list-section" class="nav-section">
72
- <h3>Methods</h3>
73
-
74
- <ul class="link-list" role="directory">
75
- <li ><a href="#method-c-new">::new</a>
76
- <li ><a href="#method-i-filter_headers">#filter_headers</a>
77
- <li ><a href="#method-i-to_h">#to_h</a>
78
- </ul>
79
- </div>
80
-
81
- </div>
82
- </nav>
83
-
84
- <main role="main" aria-labelledby="class-TrueLayerSigning::JwsHeader">
85
- <h1 id="class-TrueLayerSigning::JwsHeader" class="class">
86
- class TrueLayerSigning::JwsHeader
87
- </h1>
88
-
89
- <section class="description">
90
-
91
- </section>
92
-
93
- <section id="5Buntitled-5D" class="documentation-section">
94
-
95
-
96
-
97
- <section class="attribute-method-details" class="method-section">
98
- <header>
99
- <h3>Attributes</h3>
100
- </header>
101
-
102
- <div id="attribute-i-alg" class="method-detail">
103
- <div class="method-heading attribute-method-heading">
104
- <span class="method-name">alg</span><span
105
- class="attribute-access-type">[R]</span>
106
- </div>
107
-
108
- <div class="method-description">
109
-
110
- </div>
111
- </div>
112
- <div id="attribute-i-jku" class="method-detail">
113
- <div class="method-heading attribute-method-heading">
114
- <span class="method-name">jku</span><span
115
- class="attribute-access-type">[R]</span>
116
- </div>
117
-
118
- <div class="method-description">
119
-
120
- </div>
121
- </div>
122
- <div id="attribute-i-kid" class="method-detail">
123
- <div class="method-heading attribute-method-heading">
124
- <span class="method-name">kid</span><span
125
- class="attribute-access-type">[R]</span>
126
- </div>
127
-
128
- <div class="method-description">
129
-
130
- </div>
131
- </div>
132
- <div id="attribute-i-tl_headers" class="method-detail">
133
- <div class="method-heading attribute-method-heading">
134
- <span class="method-name">tl_headers</span><span
135
- class="attribute-access-type">[R]</span>
136
- </div>
137
-
138
- <div class="method-description">
139
-
140
- </div>
141
- </div>
142
- <div id="attribute-i-tl_version" class="method-detail">
143
- <div class="method-heading attribute-method-heading">
144
- <span class="method-name">tl_version</span><span
145
- class="attribute-access-type">[R]</span>
146
- </div>
147
-
148
- <div class="method-description">
149
-
150
- </div>
151
- </div>
152
- </section>
153
-
154
-
155
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
156
- <header>
157
- <h3>Public Class Methods</h3>
158
- </header>
159
-
160
- <div id="method-c-new" class="method-detail ">
161
- <div class="method-header">
162
- <div class="method-heading">
163
- <span class="method-name">new</span><span
164
- class="method-args">(args = {})</span>
165
- <span class="method-click-advice">click to toggle source</span>
166
- </div>
167
- </div>
168
-
169
- <div class="method-description">
170
-
171
-
172
- <div class="method-source-code" id="new-source">
173
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 5</span>
174
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">args</span> = {})
175
- <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Error</span>, <span class="ruby-string">&quot;TRUELAYER_SIGNING_CERTIFICATE_ID is missing&quot;</span>) \
176
- <span class="ruby-keyword">if</span> <span class="ruby-constant">TrueLayerSigning</span>.<span class="ruby-identifier">certificate_id</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span>
177
- <span class="ruby-constant">TrueLayerSigning</span>.<span class="ruby-identifier">certificate_id</span>.<span class="ruby-identifier">empty?</span>
178
-
179
- <span class="ruby-ivar">@alg</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:alg</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">TrueLayerSigning</span>.<span class="ruby-identifier">algorithm</span>
180
- <span class="ruby-ivar">@kid</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:kid</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">TrueLayerSigning</span>.<span class="ruby-identifier">certificate_id</span>
181
- <span class="ruby-ivar">@tl_version</span> = <span class="ruby-constant">TrueLayerSigning</span>.<span class="ruby-identifier">version</span>
182
- <span class="ruby-ivar">@tl_headers</span> = <span class="ruby-identifier">retrieve_headers</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">:tl_headers</span>])
183
- <span class="ruby-ivar">@jku</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:jku</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword">nil</span>
184
- <span class="ruby-keyword">end</span></pre>
185
- </div>
186
- </div>
187
-
188
-
189
- </div>
190
-
191
- </section>
192
-
193
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
194
- <header>
195
- <h3>Public Instance Methods</h3>
196
- </header>
197
-
198
- <div id="method-i-filter_headers" class="method-detail ">
199
- <div class="method-header">
200
- <div class="method-heading">
201
- <span class="method-name">filter_headers</span><span
202
- class="method-args">(headers)</span>
203
- <span class="method-click-advice">click to toggle source</span>
204
- </div>
205
- </div>
206
-
207
- <div class="method-description">
208
-
209
-
210
- <div class="method-source-code" id="filter_headers-source">
211
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 22</span>
212
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">filter_headers</span>(<span class="ruby-identifier">headers</span>)
213
- <span class="ruby-identifier">required_header_keys</span> = <span class="ruby-identifier">tl_headers</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;,&quot;</span>).<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">empty?</span> }
214
- <span class="ruby-identifier">normalised_headers</span> = {}
215
- <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">header</span><span class="ruby-operator">|</span> <span class="ruby-identifier">normalised_headers</span>[<span class="ruby-identifier">header</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">downcase</span>] = <span class="ruby-identifier">header</span>.<span class="ruby-identifier">last</span> }
216
-
217
- <span class="ruby-identifier">ordered_headers</span> = <span class="ruby-identifier">required_header_keys</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
218
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">normalised_headers</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">downcase</span>]
219
-
220
- <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Error</span>, <span class="ruby-string">&quot;Missing header(s) declared in signature&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">value</span>
221
-
222
- [<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>]
223
- <span class="ruby-keyword">end</span>
224
-
225
- <span class="ruby-identifier">ordered_headers</span>.<span class="ruby-identifier">to_h</span>
226
- <span class="ruby-keyword">end</span></pre>
227
- </div>
228
- </div>
229
-
230
-
231
- </div>
232
-
233
- <div id="method-i-to_h" class="method-detail ">
234
- <div class="method-header">
235
- <div class="method-heading">
236
- <span class="method-name">to_h</span><span
237
- class="method-args">()</span>
238
- <span class="method-click-advice">click to toggle source</span>
239
- </div>
240
- </div>
241
-
242
- <div class="method-description">
243
-
244
-
245
- <div class="method-source-code" id="to_h-source">
246
- <pre><span class="ruby-comment"># File lib/truelayer-signing/utils.rb, line 17</span>
247
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_h</span>
248
- <span class="ruby-identifier">hash</span> = <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">var</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">var</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">var</span>)] }.<span class="ruby-identifier">to_h</span>
249
- <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">_value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>].<span class="ruby-identifier">nil?</span> }
250
- <span class="ruby-keyword">end</span></pre>
251
- </div>
252
- </div>
253
-
254
-
255
- </div>
256
-
257
- </section>
258
-
259
- </section>
260
- </main>
261
-
262
-
263
- <footer id="validator-badges" role="contentinfo">
264
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
265
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.5.0.
266
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
267
- </footer>
268
-