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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +12 -2
- data/examples/webhook-server/Gemfile +1 -0
- data/examples/webhook-server/Gemfile.lock +28 -3
- data/examples/webhook-server/main.rb +15 -14
- data/lib/truelayer-signing/jwt.rb +1 -1
- data/lib/truelayer-signing/signer.rb +3 -0
- data/lib/truelayer-signing/utils.rb +8 -1
- data/lib/truelayer-signing/verifier.rb +80 -20
- data/lib/truelayer-signing.rb +9 -1
- data/test/resources/failed-payment-expired-test-payload.json +12 -0
- data/test/resources/missing-zero-padding-test-jwks.json +19 -0
- data/test/resources/missing-zero-padding-test-payload.json +22 -0
- data/test/resources/missing-zero-padding-test-signature.txt +1 -0
- data/test/test-truelayer-signing.rb +141 -7
- data/truelayer-signing.gemspec +2 -2
- metadata +10 -75
- data/doc/CHANGELOG_md.html +0 -132
- data/doc/JWT/Decode.html +0 -97
- data/doc/JWT/Encode.html +0 -97
- data/doc/JWT/JWK/EC.html +0 -169
- data/doc/JWT/JWK.html +0 -91
- data/doc/JWT.html +0 -95
- data/doc/LICENSE-APACHE.html +0 -177
- data/doc/LICENSE-MIT.html +0 -105
- data/doc/README_md.html +0 -197
- data/doc/Rakefile.html +0 -106
- data/doc/TrueLayerSigning/Config.html +0 -211
- data/doc/TrueLayerSigning/Error.html +0 -97
- data/doc/TrueLayerSigning/JwsBase.html +0 -317
- data/doc/TrueLayerSigning/JwsHeader.html +0 -268
- data/doc/TrueLayerSigning/Signer.html +0 -186
- data/doc/TrueLayerSigning/Verifier.html +0 -327
- data/doc/TrueLayerSigning.html +0 -226
- data/doc/TrueLayerSigningExamples.html +0 -217
- data/doc/created.rid +0 -21
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -662
- data/doc/examples/sign-request/Gemfile.html +0 -99
- data/doc/examples/sign-request/Gemfile_lock.html +0 -143
- data/doc/examples/sign-request/README_md.html +0 -138
- data/doc/examples/webhook-server/Gemfile.html +0 -99
- data/doc/examples/webhook-server/Gemfile_lock.html +0 -142
- data/doc/examples/webhook-server/README_md.html +0 -139
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -118
- data/doc/js/darkfish.js +0 -84
- data/doc/js/navigation.js +0 -105
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -110
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -229
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -269
- data/examples/sign-request/Gemfile.lock +0 -40
data/doc/TrueLayerSigning.html
DELETED
@@ -1,226 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>module TrueLayerSigning - 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="module">
|
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
|
-
|
62
|
-
|
63
|
-
<div id="extends-section" class="nav-section">
|
64
|
-
<h3>Extended With Modules</h3>
|
65
|
-
|
66
|
-
<ul class="link-list">
|
67
|
-
<li><span class="extend">Forwardable</span>
|
68
|
-
</ul>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
|
72
|
-
<!-- Method Quickref -->
|
73
|
-
<div id="method-list-section" class="nav-section">
|
74
|
-
<h3>Methods</h3>
|
75
|
-
|
76
|
-
<ul class="link-list" role="directory">
|
77
|
-
<li ><a href="#method-c-extract_jws_header">::extract_jws_header</a>
|
78
|
-
<li ><a href="#method-c-sign_with_pem">::sign_with_pem</a>
|
79
|
-
<li ><a href="#method-c-verify_with_jwks">::verify_with_jwks</a>
|
80
|
-
<li ><a href="#method-c-verify_with_pem">::verify_with_pem</a>
|
81
|
-
</ul>
|
82
|
-
</div>
|
83
|
-
|
84
|
-
</div>
|
85
|
-
</nav>
|
86
|
-
|
87
|
-
<main role="main" aria-labelledby="module-TrueLayerSigning">
|
88
|
-
<h1 id="module-TrueLayerSigning" class="module">
|
89
|
-
module TrueLayerSigning
|
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-c-config" class="method-detail">
|
106
|
-
<div class="method-heading attribute-method-heading">
|
107
|
-
<span class="method-name">config</span><span
|
108
|
-
class="attribute-access-type">[R]</span>
|
109
|
-
</div>
|
110
|
-
|
111
|
-
<div class="method-description">
|
112
|
-
|
113
|
-
</div>
|
114
|
-
</div>
|
115
|
-
</section>
|
116
|
-
|
117
|
-
|
118
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
119
|
-
<header>
|
120
|
-
<h3>Public Class Methods</h3>
|
121
|
-
</header>
|
122
|
-
|
123
|
-
<div id="method-c-extract_jws_header" class="method-detail ">
|
124
|
-
<div class="method-header">
|
125
|
-
<div class="method-heading">
|
126
|
-
<span class="method-name">extract_jws_header</span><span
|
127
|
-
class="method-args">(signature)</span>
|
128
|
-
<span class="method-click-advice">click to toggle source</span>
|
129
|
-
</div>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
<div class="method-description">
|
133
|
-
|
134
|
-
|
135
|
-
<div class="method-source-code" id="extract_jws_header-source">
|
136
|
-
<pre><span class="ruby-comment"># File lib/truelayer-signing.rb, line 39</span>
|
137
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">extract_jws_header</span>(<span class="ruby-identifier">signature</span>)
|
138
|
-
<span class="ruby-constant">Verifier</span>.<span class="ruby-identifier">parse_tl_signature</span>(<span class="ruby-identifier">signature</span>).<span class="ruby-identifier">first</span>
|
139
|
-
<span class="ruby-keyword">end</span></pre>
|
140
|
-
</div>
|
141
|
-
</div>
|
142
|
-
|
143
|
-
|
144
|
-
</div>
|
145
|
-
|
146
|
-
<div id="method-c-sign_with_pem" class="method-detail ">
|
147
|
-
<div class="method-header">
|
148
|
-
<div class="method-heading">
|
149
|
-
<span class="method-name">sign_with_pem</span><span
|
150
|
-
class="method-args">()</span>
|
151
|
-
<span class="method-click-advice">click to toggle source</span>
|
152
|
-
</div>
|
153
|
-
</div>
|
154
|
-
|
155
|
-
<div class="method-description">
|
156
|
-
|
157
|
-
|
158
|
-
<div class="method-source-code" id="sign_with_pem-source">
|
159
|
-
<pre><span class="ruby-comment"># File lib/truelayer-signing.rb, line 27</span>
|
160
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sign_with_pem</span>
|
161
|
-
<span class="ruby-constant">Signer</span>.<span class="ruby-identifier">new</span>
|
162
|
-
<span class="ruby-keyword">end</span></pre>
|
163
|
-
</div>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
|
167
|
-
</div>
|
168
|
-
|
169
|
-
<div id="method-c-verify_with_jwks" class="method-detail ">
|
170
|
-
<div class="method-header">
|
171
|
-
<div class="method-heading">
|
172
|
-
<span class="method-name">verify_with_jwks</span><span
|
173
|
-
class="method-args">(jwks)</span>
|
174
|
-
<span class="method-click-advice">click to toggle source</span>
|
175
|
-
</div>
|
176
|
-
</div>
|
177
|
-
|
178
|
-
<div class="method-description">
|
179
|
-
|
180
|
-
|
181
|
-
<div class="method-source-code" id="verify_with_jwks-source">
|
182
|
-
<pre><span class="ruby-comment"># File lib/truelayer-signing.rb, line 35</span>
|
183
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">verify_with_jwks</span>(<span class="ruby-identifier">jwks</span>)
|
184
|
-
<span class="ruby-constant">Verifier</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">key_type:</span> <span class="ruby-value">:jwks</span>, <span class="ruby-value">key_value:</span> <span class="ruby-identifier">jwks</span>)
|
185
|
-
<span class="ruby-keyword">end</span></pre>
|
186
|
-
</div>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div id="method-c-verify_with_pem" class="method-detail ">
|
193
|
-
<div class="method-header">
|
194
|
-
<div class="method-heading">
|
195
|
-
<span class="method-name">verify_with_pem</span><span
|
196
|
-
class="method-args">(pem)</span>
|
197
|
-
<span class="method-click-advice">click to toggle source</span>
|
198
|
-
</div>
|
199
|
-
</div>
|
200
|
-
|
201
|
-
<div class="method-description">
|
202
|
-
|
203
|
-
|
204
|
-
<div class="method-source-code" id="verify_with_pem-source">
|
205
|
-
<pre><span class="ruby-comment"># File lib/truelayer-signing.rb, line 31</span>
|
206
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">verify_with_pem</span>(<span class="ruby-identifier">pem</span>)
|
207
|
-
<span class="ruby-constant">Verifier</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">key_type:</span> <span class="ruby-value">:pem</span>, <span class="ruby-value">key_value:</span> <span class="ruby-identifier">pem</span>)
|
208
|
-
<span class="ruby-keyword">end</span></pre>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
|
213
|
-
</div>
|
214
|
-
|
215
|
-
</section>
|
216
|
-
|
217
|
-
</section>
|
218
|
-
</main>
|
219
|
-
|
220
|
-
|
221
|
-
<footer id="validator-badges" role="contentinfo">
|
222
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
223
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.5.0.
|
224
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
225
|
-
</footer>
|
226
|
-
|
@@ -1,217 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class TrueLayerSigningExamples - 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-run_webhook_server">::run_webhook_server</a>
|
76
|
-
<li ><a href="#method-c-test_signature_endpoint">::test_signature_endpoint</a>
|
77
|
-
</ul>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
</div>
|
81
|
-
</nav>
|
82
|
-
|
83
|
-
<main role="main" aria-labelledby="class-TrueLayerSigningExamples">
|
84
|
-
<h1 id="class-TrueLayerSigningExamples" class="class">
|
85
|
-
class TrueLayerSigningExamples
|
86
|
-
</h1>
|
87
|
-
|
88
|
-
<section class="description">
|
89
|
-
|
90
|
-
</section>
|
91
|
-
|
92
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
93
|
-
|
94
|
-
|
95
|
-
<section class="constants-list">
|
96
|
-
<header>
|
97
|
-
<h3>Constants</h3>
|
98
|
-
</header>
|
99
|
-
<dl>
|
100
|
-
<dt id="TRUELAYER_SIGNING_ACCESS_TOKEN">TRUELAYER_SIGNING_ACCESS_TOKEN
|
101
|
-
<dd><p>Set required environment variables</p>
|
102
|
-
<dt id="TRUELAYER_SIGNING_BASE_URL">TRUELAYER_SIGNING_BASE_URL
|
103
|
-
<dd>
|
104
|
-
<dt id="WEBHOOK_PATH">WEBHOOK_PATH
|
105
|
-
<dd><p>Note: the webhook path can be whatever is configured for your application. Here a unique path is used, matching the example signature in the <a href="README_md.html">README</a>.</p>
|
106
|
-
</dl>
|
107
|
-
</section>
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
112
|
-
<header>
|
113
|
-
<h3>Public Class Methods</h3>
|
114
|
-
</header>
|
115
|
-
|
116
|
-
<div id="method-c-run_webhook_server" class="method-detail ">
|
117
|
-
<div class="method-header">
|
118
|
-
<div class="method-heading">
|
119
|
-
<span class="method-name">run_webhook_server</span><span
|
120
|
-
class="method-args">()</span>
|
121
|
-
<span class="method-click-advice">click to toggle source</span>
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
|
125
|
-
<div class="method-description">
|
126
|
-
|
127
|
-
|
128
|
-
<div class="method-source-code" id="run_webhook_server-source">
|
129
|
-
<pre><span class="ruby-comment"># File examples/webhook-server/main.rb, line 11</span>
|
130
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run_webhook_server</span>
|
131
|
-
<span class="ruby-identifier">server</span> = <span class="ruby-constant">TCPServer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">4567</span>)
|
132
|
-
|
133
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Server running at http://localhost:4567"</span>
|
134
|
-
|
135
|
-
<span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
|
136
|
-
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">server</span>.<span class="ruby-identifier">accept</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">client</span><span class="ruby-operator">|</span>
|
137
|
-
<span class="ruby-keyword">begin</span>
|
138
|
-
<span class="ruby-identifier">request</span> = <span class="ruby-identifier">parse_request</span>(<span class="ruby-identifier">client</span>)
|
139
|
-
<span class="ruby-identifier">status</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">handle_request</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">request</span>)
|
140
|
-
<span class="ruby-identifier">headers</span> = { <span class="ruby-string">"Content-Type"</span> <span class="ruby-operator">=></span> <span class="ruby-string">"text/plain"</span> }
|
141
|
-
|
142
|
-
<span class="ruby-identifier">send_response</span>(<span class="ruby-identifier">client</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span>)
|
143
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">error</span>
|
144
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">error</span>
|
145
|
-
<span class="ruby-keyword">ensure</span>
|
146
|
-
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span>
|
147
|
-
<span class="ruby-keyword">end</span>
|
148
|
-
<span class="ruby-keyword">end</span>
|
149
|
-
<span class="ruby-keyword">end</span>
|
150
|
-
<span class="ruby-keyword">end</span></pre>
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
|
154
|
-
|
155
|
-
</div>
|
156
|
-
|
157
|
-
<div id="method-c-test_signature_endpoint" class="method-detail ">
|
158
|
-
<div class="method-header">
|
159
|
-
<div class="method-heading">
|
160
|
-
<span class="method-name">test_signature_endpoint</span><span
|
161
|
-
class="method-args">()</span>
|
162
|
-
<span class="method-click-advice">click to toggle source</span>
|
163
|
-
</div>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
<div class="method-description">
|
167
|
-
|
168
|
-
|
169
|
-
<div class="method-source-code" id="test_signature_endpoint-source">
|
170
|
-
<pre><span class="ruby-comment"># File examples/sign-request/main.rb, line 14</span>
|
171
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_signature_endpoint</span>
|
172
|
-
<span class="ruby-identifier">url</span> = <span class="ruby-node">"#{TRUELAYER_SIGNING_BASE_URL}/test-signature"</span>
|
173
|
-
<span class="ruby-identifier">idempotency_key</span> = <span class="ruby-constant">SecureRandom</span>.<span class="ruby-identifier">uuid</span>
|
174
|
-
|
175
|
-
<span class="ruby-comment"># A random body string is enough for this request as the `/test-signature` endpoint does not</span>
|
176
|
-
<span class="ruby-comment"># require any schema, it simply checks the signature is valid against what's received.</span>
|
177
|
-
<span class="ruby-identifier">body</span> = <span class="ruby-node">"body-#{SecureRandom.uuid}"</span>
|
178
|
-
|
179
|
-
<span class="ruby-comment"># Generate a `Tl-Signature`</span>
|
180
|
-
<span class="ruby-identifier">signature</span> = <span class="ruby-constant">TrueLayerSigning</span>.<span class="ruby-identifier">sign_with_pem</span>
|
181
|
-
.<span class="ruby-identifier">set_method</span>(<span class="ruby-string">"POST"</span>)
|
182
|
-
.<span class="ruby-identifier">set_path</span>(<span class="ruby-string">"/test-signature"</span>)
|
183
|
-
<span class="ruby-comment"># Optional: `/test-signature` does not require any headers, but we may sign some anyway.</span>
|
184
|
-
<span class="ruby-comment"># All signed headers *must* be included unmodified in the request.</span>
|
185
|
-
.<span class="ruby-identifier">add_header</span>(<span class="ruby-string">"Idempotency-Key"</span>, <span class="ruby-identifier">idempotency_key</span>)
|
186
|
-
.<span class="ruby-identifier">add_header</span>(<span class="ruby-string">"X-Bar-Header"</span>, <span class="ruby-string">"abc123"</span>)
|
187
|
-
.<span class="ruby-identifier">set_body</span>(<span class="ruby-identifier">body</span>)
|
188
|
-
.<span class="ruby-identifier">sign</span>
|
189
|
-
|
190
|
-
<span class="ruby-identifier">response</span> = <span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">auth</span>(<span class="ruby-node">"Bearer #{TRUELAYER_SIGNING_ACCESS_TOKEN}"</span>)
|
191
|
-
.<span class="ruby-identifier">headers</span>(<span class="ruby-value">idempotency_key:</span> <span class="ruby-identifier">idempotency_key</span>)
|
192
|
-
.<span class="ruby-identifier">headers</span>(<span class="ruby-value">x_bar_header:</span> <span class="ruby-string">"abc123"</span>)
|
193
|
-
.<span class="ruby-identifier">headers</span>(<span class="ruby-value">tl_signature:</span> <span class="ruby-identifier">signature</span>)
|
194
|
-
.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">url</span>, <span class="ruby-value">body:</span> <span class="ruby-identifier">body</span>)
|
195
|
-
|
196
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">puts</span> <span class="ruby-string">"✓ Signature is valid"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>.<span class="ruby-identifier">success?</span>
|
197
|
-
|
198
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">pretty_generate</span>(<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">to_s</span>))
|
199
|
-
<span class="ruby-keyword">end</span></pre>
|
200
|
-
</div>
|
201
|
-
</div>
|
202
|
-
|
203
|
-
|
204
|
-
</div>
|
205
|
-
|
206
|
-
</section>
|
207
|
-
|
208
|
-
</section>
|
209
|
-
</main>
|
210
|
-
|
211
|
-
|
212
|
-
<footer id="validator-badges" role="contentinfo">
|
213
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
214
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.5.0.
|
215
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
216
|
-
</footer>
|
217
|
-
|
data/doc/created.rid
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
Fri, 06 Jan 2023 21:29:00 +0100
|
2
|
-
CHANGELOG.md Wed, 04 Jan 2023 16:24:30 +0100
|
3
|
-
LICENSE-APACHE Fri, 30 Dec 2022 12:44:19 +0100
|
4
|
-
LICENSE-MIT Fri, 30 Dec 2022 12:44:19 +0100
|
5
|
-
README.md Tue, 03 Jan 2023 23:34:43 +0100
|
6
|
-
Rakefile Mon, 02 Jan 2023 17:20:34 +0100
|
7
|
-
examples/sign-request/Gemfile Tue, 03 Jan 2023 23:54:42 +0100
|
8
|
-
examples/sign-request/Gemfile.lock Wed, 04 Jan 2023 17:33:43 +0100
|
9
|
-
examples/sign-request/README.md Tue, 03 Jan 2023 23:54:42 +0100
|
10
|
-
examples/sign-request/main.rb Tue, 03 Jan 2023 23:54:42 +0100
|
11
|
-
examples/webhook-server/Gemfile Wed, 04 Jan 2023 19:21:27 +0100
|
12
|
-
examples/webhook-server/Gemfile.lock Wed, 04 Jan 2023 21:30:50 +0100
|
13
|
-
examples/webhook-server/README.md Thu, 05 Jan 2023 00:12:45 +0100
|
14
|
-
examples/webhook-server/main.rb Thu, 05 Jan 2023 00:12:29 +0100
|
15
|
-
lib/truelayer-signing/config.rb Mon, 02 Jan 2023 22:14:12 +0100
|
16
|
-
lib/truelayer-signing/errors.rb Wed, 04 Jan 2023 15:55:26 +0100
|
17
|
-
lib/truelayer-signing/jwt.rb Fri, 06 Jan 2023 21:17:20 +0100
|
18
|
-
lib/truelayer-signing/signer.rb Wed, 04 Jan 2023 15:59:19 +0100
|
19
|
-
lib/truelayer-signing/utils.rb Wed, 04 Jan 2023 23:12:55 +0100
|
20
|
-
lib/truelayer-signing/verifier.rb Fri, 06 Jan 2023 21:17:52 +0100
|
21
|
-
lib/truelayer-signing.rb Tue, 03 Jan 2023 20:00:34 +0100
|
data/doc/css/fonts.css
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
|
3
|
-
* with Reserved Font Name "Source". All Rights Reserved. Source is a
|
4
|
-
* trademark of Adobe Systems Incorporated in the United States and/or other
|
5
|
-
* countries.
|
6
|
-
*
|
7
|
-
* This Font Software is licensed under the SIL Open Font License, Version
|
8
|
-
* 1.1.
|
9
|
-
*
|
10
|
-
* This license is copied below, and is also available with a FAQ at:
|
11
|
-
* http://scripts.sil.org/OFL
|
12
|
-
*/
|
13
|
-
|
14
|
-
@font-face {
|
15
|
-
font-family: "Source Code Pro";
|
16
|
-
font-style: normal;
|
17
|
-
font-weight: 400;
|
18
|
-
src: local("Source Code Pro"),
|
19
|
-
local("SourceCodePro-Regular"),
|
20
|
-
url("../fonts/SourceCodePro-Regular.ttf") format("truetype");
|
21
|
-
}
|
22
|
-
|
23
|
-
@font-face {
|
24
|
-
font-family: "Source Code Pro";
|
25
|
-
font-style: normal;
|
26
|
-
font-weight: 700;
|
27
|
-
src: local("Source Code Pro Bold"),
|
28
|
-
local("SourceCodePro-Bold"),
|
29
|
-
url("../fonts/SourceCodePro-Bold.ttf") format("truetype");
|
30
|
-
}
|
31
|
-
|
32
|
-
/*
|
33
|
-
* Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com),
|
34
|
-
* with Reserved Font Name Lato.
|
35
|
-
*
|
36
|
-
* This Font Software is licensed under the SIL Open Font License, Version
|
37
|
-
* 1.1.
|
38
|
-
*
|
39
|
-
* This license is copied below, and is also available with a FAQ at:
|
40
|
-
* http://scripts.sil.org/OFL
|
41
|
-
*/
|
42
|
-
|
43
|
-
@font-face {
|
44
|
-
font-family: "Lato";
|
45
|
-
font-style: normal;
|
46
|
-
font-weight: 300;
|
47
|
-
src: local("Lato Light"),
|
48
|
-
local("Lato-Light"),
|
49
|
-
url("../fonts/Lato-Light.ttf") format("truetype");
|
50
|
-
}
|
51
|
-
|
52
|
-
@font-face {
|
53
|
-
font-family: "Lato";
|
54
|
-
font-style: italic;
|
55
|
-
font-weight: 300;
|
56
|
-
src: local("Lato Light Italic"),
|
57
|
-
local("Lato-LightItalic"),
|
58
|
-
url("../fonts/Lato-LightItalic.ttf") format("truetype");
|
59
|
-
}
|
60
|
-
|
61
|
-
@font-face {
|
62
|
-
font-family: "Lato";
|
63
|
-
font-style: normal;
|
64
|
-
font-weight: 700;
|
65
|
-
src: local("Lato Regular"),
|
66
|
-
local("Lato-Regular"),
|
67
|
-
url("../fonts/Lato-Regular.ttf") format("truetype");
|
68
|
-
}
|
69
|
-
|
70
|
-
@font-face {
|
71
|
-
font-family: "Lato";
|
72
|
-
font-style: italic;
|
73
|
-
font-weight: 700;
|
74
|
-
src: local("Lato Italic"),
|
75
|
-
local("Lato-Italic"),
|
76
|
-
url("../fonts/Lato-RegularItalic.ttf") format("truetype");
|
77
|
-
}
|
78
|
-
|
79
|
-
/*
|
80
|
-
* -----------------------------------------------------------
|
81
|
-
* SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
82
|
-
* -----------------------------------------------------------
|
83
|
-
*
|
84
|
-
* PREAMBLE
|
85
|
-
* The goals of the Open Font License (OFL) are to stimulate worldwide
|
86
|
-
* development of collaborative font projects, to support the font creation
|
87
|
-
* efforts of academic and linguistic communities, and to provide a free and
|
88
|
-
* open framework in which fonts may be shared and improved in partnership
|
89
|
-
* with others.
|
90
|
-
*
|
91
|
-
* The OFL allows the licensed fonts to be used, studied, modified and
|
92
|
-
* redistributed freely as long as they are not sold by themselves. The
|
93
|
-
* fonts, including any derivative works, can be bundled, embedded,
|
94
|
-
* redistributed and/or sold with any software provided that any reserved
|
95
|
-
* names are not used by derivative works. The fonts and derivatives,
|
96
|
-
* however, cannot be released under any other type of license. The
|
97
|
-
* requirement for fonts to remain under this license does not apply
|
98
|
-
* to any document created using the fonts or their derivatives.
|
99
|
-
*
|
100
|
-
* DEFINITIONS
|
101
|
-
* "Font Software" refers to the set of files released by the Copyright
|
102
|
-
* Holder(s) under this license and clearly marked as such. This may
|
103
|
-
* include source files, build scripts and documentation.
|
104
|
-
*
|
105
|
-
* "Reserved Font Name" refers to any names specified as such after the
|
106
|
-
* copyright statement(s).
|
107
|
-
*
|
108
|
-
* "Original Version" refers to the collection of Font Software components as
|
109
|
-
* distributed by the Copyright Holder(s).
|
110
|
-
*
|
111
|
-
* "Modified Version" refers to any derivative made by adding to, deleting,
|
112
|
-
* or substituting -- in part or in whole -- any of the components of the
|
113
|
-
* Original Version, by changing formats or by porting the Font Software to a
|
114
|
-
* new environment.
|
115
|
-
*
|
116
|
-
* "Author" refers to any designer, engineer, programmer, technical
|
117
|
-
* writer or other person who contributed to the Font Software.
|
118
|
-
*
|
119
|
-
* PERMISSION & CONDITIONS
|
120
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
121
|
-
* a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
122
|
-
* redistribute, and sell modified and unmodified copies of the Font
|
123
|
-
* Software, subject to the following conditions:
|
124
|
-
*
|
125
|
-
* 1) Neither the Font Software nor any of its individual components,
|
126
|
-
* in Original or Modified Versions, may be sold by itself.
|
127
|
-
*
|
128
|
-
* 2) Original or Modified Versions of the Font Software may be bundled,
|
129
|
-
* redistributed and/or sold with any software, provided that each copy
|
130
|
-
* contains the above copyright notice and this license. These can be
|
131
|
-
* included either as stand-alone text files, human-readable headers or
|
132
|
-
* in the appropriate machine-readable metadata fields within text or
|
133
|
-
* binary files as long as those fields can be easily viewed by the user.
|
134
|
-
*
|
135
|
-
* 3) No Modified Version of the Font Software may use the Reserved Font
|
136
|
-
* Name(s) unless explicit written permission is granted by the corresponding
|
137
|
-
* Copyright Holder. This restriction only applies to the primary font name as
|
138
|
-
* presented to the users.
|
139
|
-
*
|
140
|
-
* 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
141
|
-
* Software shall not be used to promote, endorse or advertise any
|
142
|
-
* Modified Version, except to acknowledge the contribution(s) of the
|
143
|
-
* Copyright Holder(s) and the Author(s) or with their explicit written
|
144
|
-
* permission.
|
145
|
-
*
|
146
|
-
* 5) The Font Software, modified or unmodified, in part or in whole,
|
147
|
-
* must be distributed entirely under this license, and must not be
|
148
|
-
* distributed under any other license. The requirement for fonts to
|
149
|
-
* remain under this license does not apply to any document created
|
150
|
-
* using the Font Software.
|
151
|
-
*
|
152
|
-
* TERMINATION
|
153
|
-
* This license becomes null and void if any of the above conditions are
|
154
|
-
* not met.
|
155
|
-
*
|
156
|
-
* DISCLAIMER
|
157
|
-
* THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
158
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
159
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
160
|
-
* OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
161
|
-
* COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
162
|
-
* INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
163
|
-
* DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
164
|
-
* FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
165
|
-
* OTHER DEALINGS IN THE FONT SOFTWARE.
|
166
|
-
*/
|
167
|
-
|