truelayer-signing 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +14 -0
- data/LICENSE-APACHE +176 -0
- data/LICENSE-MIT +21 -0
- data/README.md +82 -0
- data/Rakefile +8 -0
- data/doc/CHANGELOG_md.html +132 -0
- data/doc/JWT/Decode.html +97 -0
- data/doc/JWT/Encode.html +97 -0
- data/doc/JWT/JWK/EC.html +169 -0
- data/doc/JWT/JWK.html +91 -0
- data/doc/JWT.html +95 -0
- data/doc/LICENSE-APACHE.html +177 -0
- data/doc/LICENSE-MIT.html +105 -0
- data/doc/README_md.html +197 -0
- data/doc/Rakefile.html +106 -0
- data/doc/TrueLayerSigning/Config.html +211 -0
- data/doc/TrueLayerSigning/Error.html +97 -0
- data/doc/TrueLayerSigning/JwsBase.html +317 -0
- data/doc/TrueLayerSigning/JwsHeader.html +268 -0
- data/doc/TrueLayerSigning/Signer.html +186 -0
- data/doc/TrueLayerSigning/Verifier.html +327 -0
- data/doc/TrueLayerSigning.html +226 -0
- data/doc/TrueLayerSigningExamples.html +217 -0
- data/doc/created.rid +21 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +662 -0
- data/doc/examples/sign-request/Gemfile.html +99 -0
- data/doc/examples/sign-request/Gemfile_lock.html +143 -0
- data/doc/examples/sign-request/README_md.html +138 -0
- data/doc/examples/webhook-server/Gemfile.html +99 -0
- data/doc/examples/webhook-server/Gemfile_lock.html +142 -0
- data/doc/examples/webhook-server/README_md.html +139 -0
- 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 +118 -0
- data/doc/js/darkfish.js +84 -0
- data/doc/js/navigation.js +105 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +110 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +229 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +269 -0
- data/examples/sign-request/Gemfile +4 -0
- data/examples/sign-request/Gemfile.lock +41 -0
- data/examples/sign-request/README.md +27 -0
- data/examples/sign-request/main.rb +46 -0
- data/examples/webhook-server/Gemfile +3 -0
- data/examples/webhook-server/Gemfile.lock +15 -0
- data/examples/webhook-server/README.md +30 -0
- data/examples/webhook-server/main.rb +98 -0
- data/lib/truelayer-signing/config.rb +21 -0
- data/lib/truelayer-signing/errors.rb +3 -0
- data/lib/truelayer-signing/jwt.rb +20 -0
- data/lib/truelayer-signing/signer.rb +34 -0
- data/lib/truelayer-signing/utils.rb +90 -0
- data/lib/truelayer-signing/verifier.rb +76 -0
- data/lib/truelayer-signing.rb +35 -0
- data/test/test-truelayer-signing.rb +372 -0
- data/truelayer-signing.gemspec +25 -0
- metadata +151 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>README - 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="file">
|
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
|
+
<div class="nav-section">
|
58
|
+
<h3>Table of Contents</h3>
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
<ul class="link-list" role="directory">
|
63
|
+
<li>
|
64
|
+
<details open>
|
65
|
+
<summary> <a href="#label-Ruby+webhook+server+example">Ruby webhook server example</a>
|
66
|
+
</summary>
|
67
|
+
<ul class="link-list" role="directory">
|
68
|
+
<li> <a href="#label-Run">Run</a>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</details>
|
72
|
+
</li>
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
<div id="project-metadata">
|
79
|
+
|
80
|
+
<div id="fileindex-section" class="nav-section">
|
81
|
+
<h3>Pages</h3>
|
82
|
+
|
83
|
+
<ul class="link-list">
|
84
|
+
<li><a href="../../CHANGELOG_md.html">CHANGELOG</a>
|
85
|
+
<li><a href="../../LICENSE-APACHE.html">LICENSE-APACHE</a>
|
86
|
+
<li><a href="../../LICENSE-MIT.html">LICENSE-MIT</a>
|
87
|
+
<li><a href="../../README_md.html">README</a>
|
88
|
+
<li><a href="../../Rakefile.html">Rakefile</a>
|
89
|
+
<li><details open><summary>examples</summary>
|
90
|
+
<ul class="link-list">
|
91
|
+
<li><a href="../../examples/sign-request/Gemfile.html">Gemfile</a>
|
92
|
+
<li><a href="../../examples/sign-request/Gemfile_lock.html">Gemfile.lock</a>
|
93
|
+
<li><a href="../../examples/sign-request/README_md.html">README</a>
|
94
|
+
<li><a href="../../examples/webhook-server/Gemfile.html">Gemfile</a>
|
95
|
+
<li><a href="../../examples/webhook-server/Gemfile_lock.html">Gemfile.lock</a>
|
96
|
+
<li><a href="../../examples/webhook-server/README_md.html">README</a>
|
97
|
+
</ul></details>
|
98
|
+
</ul>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
</nav>
|
103
|
+
|
104
|
+
<main role="main" aria-label="Page examples/webhook-server/README.md">
|
105
|
+
|
106
|
+
<h1 id="label-Ruby+webhook+server+example">Ruby webhook server example<span><a href="#label-Ruby+webhook+server+example">¶</a> <a href="#top">↑</a></span></h1>
|
107
|
+
|
108
|
+
<p>An HTTP server that can receive and verify signed TrueLayer webhooks.</p>
|
109
|
+
|
110
|
+
<h2 id="label-Run">Run<span><a href="#label-Run">¶</a> <a href="#top">↑</a></span></h2>
|
111
|
+
|
112
|
+
<p>Install the required dependencies:</p>
|
113
|
+
|
114
|
+
<pre>$ bundle</pre>
|
115
|
+
|
116
|
+
<p>Run the server locally:</p>
|
117
|
+
|
118
|
+
<pre>$ ruby main.rb</pre>
|
119
|
+
|
120
|
+
<p>Send a valid webhook that was signed for the path <code>/hook/d7a2c49d-110a-4ed2-a07d-8fdb3ea6424b</code>:</p>
|
121
|
+
|
122
|
+
<pre>curl -iX POST -H "Content-Type: application/json" \
|
123
|
+
-H "X-Tl-Webhook-Timestamp: 2022-03-11T14:00:33Z" \
|
124
|
+
-H "Tl-Signature: eyJhbGciOiJFUzUxMiIsImtpZCI6IjFmYzBlNTlmLWIzMzUtNDdjYS05OWE5LTczNzQ5NTc1NmE1OCIsInRsX3ZlcnNpb24iOiIyIiwidGxfaGVhZGVycyI6IngtdGwtd2ViaG9vay10aW1lc3RhbXAiLCJqa3UiOiJodHRwczovL3dlYmhvb2tzLnRydWVsYXllci5jb20vLndlbGwta25vd24vandrcyJ9..AE_QsBRhnsMkcRzd42wvY1e2HruUhkOgjuZKktGH_WmbD7rBzoaEHUuF36IxyyvCbLajd3MBExNmzjbrOQsGaspwAI5DcGVMFLKUhB7ZzUlTP9up3eNUrdwWyyfBWDQb-qmEuLnrhFDJvgCXEqlV5OLrt-O7LaRAJ4f9KHsZLQ_j2vPC" \
|
125
|
+
-d "{\"event_type\":\"payout_settled\",\"event_schema_version\":1,\"event_id\":\"8fb9fb4e-bb2b-400b-af64-59e5dde74bad\",\"event_body\":{\"transaction_id\":\"c34c8721-66a9-49f6-a229-284efcf88a02\",\"settled_at\":\"2022-03-11T14:00:32.933000Z\"}}" \
|
126
|
+
http://localhost:4567/hook/d7a2c49d-110a-4ed2-a07d-8fdb3ea6424b</pre>
|
127
|
+
|
128
|
+
<p>Modifying the <code>X-Tl-Webhook-Timestamp</code> header, the body or the path of the request will cause the above signature to be invalid.</p>
|
129
|
+
|
130
|
+
</main>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<footer id="validator-badges" role="contentinfo">
|
135
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
136
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.5.0.
|
137
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
138
|
+
</footer>
|
139
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/images/add.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/images/bug.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/images/date.png
ADDED
Binary file
|
Binary file
|
data/doc/images/find.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/images/ruby.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/images/zoom.png
ADDED
Binary file
|
data/doc/index.html
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>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="file">
|
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
|
+
|
40
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
41
|
+
<form action="#" method="get" accept-charset="utf-8">
|
42
|
+
<div id="search-field-wrapper">
|
43
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
44
|
+
aria-autocomplete="list" aria-controls="search-results"
|
45
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
46
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<ul id="search-results" aria-label="Search Results"
|
50
|
+
aria-busy="false" aria-expanded="false"
|
51
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
52
|
+
</form>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="project-metadata">
|
58
|
+
|
59
|
+
<div id="fileindex-section" class="nav-section">
|
60
|
+
<h3>Pages</h3>
|
61
|
+
|
62
|
+
<ul class="link-list">
|
63
|
+
<li><a href="./CHANGELOG_md.html">CHANGELOG</a>
|
64
|
+
<li><a href="./LICENSE-APACHE.html">LICENSE-APACHE</a>
|
65
|
+
<li><a href="./LICENSE-MIT.html">LICENSE-MIT</a>
|
66
|
+
<li><a href="./README_md.html">README</a>
|
67
|
+
<li><a href="./Rakefile.html">Rakefile</a>
|
68
|
+
<li><details><summary>examples</summary>
|
69
|
+
<ul class="link-list">
|
70
|
+
<li><a href="./examples/sign-request/Gemfile.html">Gemfile</a>
|
71
|
+
<li><a href="./examples/sign-request/Gemfile_lock.html">Gemfile.lock</a>
|
72
|
+
<li><a href="./examples/sign-request/README_md.html">README</a>
|
73
|
+
<li><a href="./examples/webhook-server/Gemfile.html">Gemfile</a>
|
74
|
+
<li><a href="./examples/webhook-server/Gemfile_lock.html">Gemfile.lock</a>
|
75
|
+
<li><a href="./examples/webhook-server/README_md.html">README</a>
|
76
|
+
</ul></details>
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<div id="classindex-section" class="nav-section">
|
81
|
+
<h3>Class and Module Index</h3>
|
82
|
+
|
83
|
+
<ul class="link-list">
|
84
|
+
<li><details><summary><code><a href="./JWT.html">JWT</a></code></summary>
|
85
|
+
<ul class="link-list">
|
86
|
+
<li><code><a href="./JWT/Decode.html">Decode</a></code>
|
87
|
+
<li><code><a href="./JWT/Encode.html">Encode</a></code>
|
88
|
+
<li><details><summary><code><a href="./JWT/JWK.html">JWK</a></code></summary>
|
89
|
+
<ul class="link-list">
|
90
|
+
<li><code><a href="./JWT/JWK/EC.html">EC</a></code>
|
91
|
+
</ul></details>
|
92
|
+
</ul></details>
|
93
|
+
<li><details><summary><code><a href="./TrueLayerSigning.html">TrueLayerSigning</a></code></summary>
|
94
|
+
<ul class="link-list">
|
95
|
+
<li><code><a href="./TrueLayerSigning/Config.html">Config</a></code>
|
96
|
+
<li><code><a href="./TrueLayerSigning/Error.html">Error</a></code>
|
97
|
+
<li><code><a href="./TrueLayerSigning/JwsBase.html">JwsBase</a></code>
|
98
|
+
<li><code><a href="./TrueLayerSigning/JwsHeader.html">JwsHeader</a></code>
|
99
|
+
<li><code><a href="./TrueLayerSigning/Signer.html">Signer</a></code>
|
100
|
+
<li><code><a href="./TrueLayerSigning/Verifier.html">Verifier</a></code>
|
101
|
+
</ul></details>
|
102
|
+
<li><code><a href="./TrueLayerSigningExamples.html">TrueLayerSigningExamples</a></code>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
</nav>
|
107
|
+
|
108
|
+
<main role="main">
|
109
|
+
<p>This is the API documentation for RDoc Documentation.
|
110
|
+
</main>
|
111
|
+
|
112
|
+
|
113
|
+
<footer id="validator-badges" role="contentinfo">
|
114
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
115
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.5.0.
|
116
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
117
|
+
</footer>
|
118
|
+
|
data/doc/js/darkfish.js
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
/**
|
2
|
+
*
|
3
|
+
* Darkfish Page Functions
|
4
|
+
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
5
|
+
*
|
6
|
+
* Author: Michael Granger <mgranger@laika.com>
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
/* Provide console simulation for firebug-less environments */
|
11
|
+
/*
|
12
|
+
if (!("console" in window) || !("firebug" in console)) {
|
13
|
+
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
14
|
+
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
15
|
+
|
16
|
+
window.console = {};
|
17
|
+
for (var i = 0; i < names.length; ++i)
|
18
|
+
window.console[names[i]] = function() {};
|
19
|
+
};
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
function showSource( e ) {
|
24
|
+
var target = e.target;
|
25
|
+
while (!target.classList.contains('method-detail')) {
|
26
|
+
target = target.parentNode;
|
27
|
+
}
|
28
|
+
if (typeof target !== "undefined" && target !== null) {
|
29
|
+
target = target.querySelector('.method-source-code');
|
30
|
+
}
|
31
|
+
if (typeof target !== "undefined" && target !== null) {
|
32
|
+
target.classList.toggle('active-menu')
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
function hookSourceViews() {
|
37
|
+
document.querySelectorAll('.method-heading').forEach(function (codeObject) {
|
38
|
+
codeObject.addEventListener('click', showSource);
|
39
|
+
});
|
40
|
+
};
|
41
|
+
|
42
|
+
function hookSearch() {
|
43
|
+
var input = document.querySelector('#search-field');
|
44
|
+
var result = document.querySelector('#search-results');
|
45
|
+
result.classList.remove("initially-hidden");
|
46
|
+
|
47
|
+
var search_section = document.querySelector('#search-section');
|
48
|
+
search_section.classList.remove("initially-hidden");
|
49
|
+
|
50
|
+
var search = new Search(search_data, input, result);
|
51
|
+
|
52
|
+
search.renderItem = function(result) {
|
53
|
+
var li = document.createElement('li');
|
54
|
+
var html = '';
|
55
|
+
|
56
|
+
// TODO add relative path to <script> per-page
|
57
|
+
html += '<p class="search-match"><a href="' + index_rel_prefix + this.escapeHTML(result.path) + '">' + this.hlt(result.title);
|
58
|
+
if (result.params)
|
59
|
+
html += '<span class="params">' + result.params + '</span>';
|
60
|
+
html += '</a>';
|
61
|
+
|
62
|
+
|
63
|
+
if (result.namespace)
|
64
|
+
html += '<p class="search-namespace">' + this.hlt(result.namespace);
|
65
|
+
|
66
|
+
if (result.snippet)
|
67
|
+
html += '<div class="search-snippet">' + result.snippet + '</div>';
|
68
|
+
|
69
|
+
li.innerHTML = html;
|
70
|
+
|
71
|
+
return li;
|
72
|
+
}
|
73
|
+
|
74
|
+
search.select = function(result) {
|
75
|
+
window.location.href = result.firstChild.firstChild.href;
|
76
|
+
}
|
77
|
+
|
78
|
+
search.scrollIntoView = search.scrollInWindow;
|
79
|
+
};
|
80
|
+
|
81
|
+
document.addEventListener('DOMContentLoaded', function() {
|
82
|
+
hookSourceViews();
|
83
|
+
hookSearch();
|
84
|
+
});
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/*
|
2
|
+
* Navigation allows movement using the arrow keys through the search results.
|
3
|
+
*
|
4
|
+
* When using this library you will need to set scrollIntoView to the
|
5
|
+
* appropriate function for your layout. Use scrollInWindow if the container
|
6
|
+
* is not scrollable and scrollInElement if the container is a separate
|
7
|
+
* scrolling region.
|
8
|
+
*/
|
9
|
+
Navigation = new function() {
|
10
|
+
this.initNavigation = function() {
|
11
|
+
var _this = this;
|
12
|
+
|
13
|
+
document.addEventListener('keydown', function(e) {
|
14
|
+
_this.onkeydown(e);
|
15
|
+
});
|
16
|
+
|
17
|
+
this.navigationActive = true;
|
18
|
+
}
|
19
|
+
|
20
|
+
this.setNavigationActive = function(state) {
|
21
|
+
this.navigationActive = state;
|
22
|
+
}
|
23
|
+
|
24
|
+
this.onkeydown = function(e) {
|
25
|
+
if (!this.navigationActive) return;
|
26
|
+
switch(e.keyCode) {
|
27
|
+
case 37: //Event.KEY_LEFT:
|
28
|
+
if (this.moveLeft()) e.preventDefault();
|
29
|
+
break;
|
30
|
+
case 38: //Event.KEY_UP:
|
31
|
+
if (e.keyCode == 38 || e.ctrlKey) {
|
32
|
+
if (this.moveUp()) e.preventDefault();
|
33
|
+
}
|
34
|
+
break;
|
35
|
+
case 39: //Event.KEY_RIGHT:
|
36
|
+
if (this.moveRight()) e.preventDefault();
|
37
|
+
break;
|
38
|
+
case 40: //Event.KEY_DOWN:
|
39
|
+
if (e.keyCode == 40 || e.ctrlKey) {
|
40
|
+
if (this.moveDown()) e.preventDefault();
|
41
|
+
}
|
42
|
+
break;
|
43
|
+
case 13: //Event.KEY_RETURN:
|
44
|
+
if (this.current) e.preventDefault();
|
45
|
+
this.select(this.current);
|
46
|
+
break;
|
47
|
+
}
|
48
|
+
if (e.ctrlKey && e.shiftKey) this.select(this.current);
|
49
|
+
}
|
50
|
+
|
51
|
+
this.moveRight = function() {
|
52
|
+
}
|
53
|
+
|
54
|
+
this.moveLeft = function() {
|
55
|
+
}
|
56
|
+
|
57
|
+
this.move = function(isDown) {
|
58
|
+
}
|
59
|
+
|
60
|
+
this.moveUp = function() {
|
61
|
+
return this.move(false);
|
62
|
+
}
|
63
|
+
|
64
|
+
this.moveDown = function() {
|
65
|
+
return this.move(true);
|
66
|
+
}
|
67
|
+
|
68
|
+
/*
|
69
|
+
* Scrolls to the given element in the scrollable element view.
|
70
|
+
*/
|
71
|
+
this.scrollInElement = function(element, view) {
|
72
|
+
var offset, viewHeight, viewScroll, height;
|
73
|
+
offset = element.offsetTop;
|
74
|
+
height = element.offsetHeight;
|
75
|
+
viewHeight = view.offsetHeight;
|
76
|
+
viewScroll = view.scrollTop;
|
77
|
+
|
78
|
+
if (offset - viewScroll + height > viewHeight) {
|
79
|
+
view.scrollTop = offset - viewHeight + height;
|
80
|
+
}
|
81
|
+
if (offset < viewScroll) {
|
82
|
+
view.scrollTop = offset;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
/*
|
87
|
+
* Scrolls to the given element in the window. The second argument is
|
88
|
+
* ignored
|
89
|
+
*/
|
90
|
+
this.scrollInWindow = function(element, ignored) {
|
91
|
+
var offset, viewHeight, viewScroll, height;
|
92
|
+
offset = element.offsetTop;
|
93
|
+
height = element.offsetHeight;
|
94
|
+
viewHeight = window.innerHeight;
|
95
|
+
viewScroll = window.scrollY;
|
96
|
+
|
97
|
+
if (offset - viewScroll + height > viewHeight) {
|
98
|
+
window.scrollTo(window.scrollX, offset - viewHeight + height);
|
99
|
+
}
|
100
|
+
if (offset < viewScroll) {
|
101
|
+
window.scrollTo(window.scrollX, offset);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
Binary file
|
data/doc/js/search.js
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
Search = function(data, input, result) {
|
2
|
+
this.data = data;
|
3
|
+
this.input = input;
|
4
|
+
this.result = result;
|
5
|
+
|
6
|
+
this.current = null;
|
7
|
+
this.view = this.result.parentNode;
|
8
|
+
this.searcher = new Searcher(data.index);
|
9
|
+
this.init();
|
10
|
+
}
|
11
|
+
|
12
|
+
Search.prototype = Object.assign({}, Navigation, new function() {
|
13
|
+
var suid = 1;
|
14
|
+
|
15
|
+
this.init = function() {
|
16
|
+
var _this = this;
|
17
|
+
var observer = function(e) {
|
18
|
+
switch(e.keyCode) {
|
19
|
+
case 38: // Event.KEY_UP
|
20
|
+
case 40: // Event.KEY_DOWN
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
_this.search(_this.input.value);
|
24
|
+
};
|
25
|
+
this.input.addEventListener('keyup', observer);
|
26
|
+
this.input.addEventListener('click', observer); // mac's clear field
|
27
|
+
|
28
|
+
this.searcher.ready(function(results, isLast) {
|
29
|
+
_this.addResults(results, isLast);
|
30
|
+
})
|
31
|
+
|
32
|
+
this.initNavigation();
|
33
|
+
this.setNavigationActive(false);
|
34
|
+
}
|
35
|
+
|
36
|
+
this.search = function(value, selectFirstMatch) {
|
37
|
+
value = value.trim().toLowerCase();
|
38
|
+
if (value) {
|
39
|
+
this.setNavigationActive(true);
|
40
|
+
} else {
|
41
|
+
this.setNavigationActive(false);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (value == '') {
|
45
|
+
this.lastQuery = value;
|
46
|
+
this.result.innerHTML = '';
|
47
|
+
this.result.setAttribute('aria-expanded', 'false');
|
48
|
+
this.setNavigationActive(false);
|
49
|
+
} else if (value != this.lastQuery) {
|
50
|
+
this.lastQuery = value;
|
51
|
+
this.result.setAttribute('aria-busy', 'true');
|
52
|
+
this.result.setAttribute('aria-expanded', 'true');
|
53
|
+
this.firstRun = true;
|
54
|
+
this.searcher.find(value);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
this.addResults = function(results, isLast) {
|
59
|
+
var target = this.result;
|
60
|
+
if (this.firstRun && (results.length > 0 || isLast)) {
|
61
|
+
this.current = null;
|
62
|
+
this.result.innerHTML = '';
|
63
|
+
}
|
64
|
+
|
65
|
+
for (var i=0, l = results.length; i < l; i++) {
|
66
|
+
var item = this.renderItem.call(this, results[i]);
|
67
|
+
item.setAttribute('id', 'search-result-' + target.childElementCount);
|
68
|
+
target.appendChild(item);
|
69
|
+
};
|
70
|
+
|
71
|
+
if (this.firstRun && results.length > 0) {
|
72
|
+
this.firstRun = false;
|
73
|
+
this.current = target.firstChild;
|
74
|
+
this.current.classList.add('search-selected');
|
75
|
+
}
|
76
|
+
//TODO: ECMAScript
|
77
|
+
//if (jQuery.browser.msie) this.$element[0].className += '';
|
78
|
+
|
79
|
+
if (isLast) this.result.setAttribute('aria-busy', 'false');
|
80
|
+
}
|
81
|
+
|
82
|
+
this.move = function(isDown) {
|
83
|
+
if (!this.current) return;
|
84
|
+
var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
|
85
|
+
if (next) {
|
86
|
+
this.current.classList.remove('search-selected');
|
87
|
+
next.classList.add('search-selected');
|
88
|
+
this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
|
89
|
+
this.scrollIntoView(next, this.view);
|
90
|
+
this.current = next;
|
91
|
+
this.input.value = next.firstChild.firstChild.text;
|
92
|
+
this.input.select();
|
93
|
+
}
|
94
|
+
return true;
|
95
|
+
}
|
96
|
+
|
97
|
+
this.hlt = function(html) {
|
98
|
+
return this.escapeHTML(html).
|
99
|
+
replace(/\u0001/g, '<em>').
|
100
|
+
replace(/\u0002/g, '</em>');
|
101
|
+
}
|
102
|
+
|
103
|
+
this.escapeHTML = function(html) {
|
104
|
+
return html.replace(/[&<>"`']/g, function(c) {
|
105
|
+
return '&#' + c.charCodeAt(0) + ';';
|
106
|
+
});
|
107
|
+
}
|
108
|
+
|
109
|
+
});
|
110
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
var search_data = {"index":{"searchIndex":["jwt","decode","encode","jwk","ec","truelayersigning","config","error","jwsbase","jwsheader","signer","verifier","truelayersigningexamples","add_header()","create_ec_key()","extract_jws_header()","filter_headers()","new()","new()","new()","new()","parse_tl_signature()","require_header()","require_headers()","run_webhook_server()","set_body()","set_headers()","set_jku()","set_method()","set_path()","setup()","sign()","sign_with_pem()","test_signature_endpoint()","to_h()","verify()","verify_with_jwks()","verify_with_pem()","changelog","license-apache","license-mit","readme","rakefile","gemfile","gemfile.lock","readme","gemfile","gemfile.lock","readme"],"longSearchIndex":["jwt","jwt::decode","jwt::encode","jwt::jwk","jwt::jwk::ec","truelayersigning","truelayersigning::config","truelayersigning::error","truelayersigning::jwsbase","truelayersigning::jwsheader","truelayersigning::signer","truelayersigning::verifier","truelayersigningexamples","truelayersigning::jwsbase#add_header()","jwt::jwk::ec#create_ec_key()","truelayersigning::extract_jws_header()","truelayersigning::jwsheader#filter_headers()","truelayersigning::config::new()","truelayersigning::jwsbase::new()","truelayersigning::jwsheader::new()","truelayersigning::verifier::new()","truelayersigning::verifier::parse_tl_signature()","truelayersigning::verifier#require_header()","truelayersigning::verifier#require_headers()","truelayersigningexamples::run_webhook_server()","truelayersigning::jwsbase#set_body()","truelayersigning::jwsbase#set_headers()","truelayersigning::signer#set_jku()","truelayersigning::jwsbase#set_method()","truelayersigning::jwsbase#set_path()","truelayersigning::config::setup()","truelayersigning::signer#sign()","truelayersigning::sign_with_pem()","truelayersigningexamples::test_signature_endpoint()","truelayersigning::jwsheader#to_h()","truelayersigning::verifier#verify()","truelayersigning::verify_with_jwks()","truelayersigning::verify_with_pem()","","","","","","","","","","",""],"info":[["JWT","","JWT.html","","<p>TODO: this is a custom patch of payload-related methods, from the ‘jwt’ gem. It prevents the …\n"],["JWT::Decode","","JWT/Decode.html","",""],["JWT::Encode","","JWT/Encode.html","",""],["JWT::JWK","","JWT/JWK.html","",""],["JWT::JWK::EC","","JWT/JWK/EC.html","",""],["TrueLayerSigning","","TrueLayerSigning.html","",""],["TrueLayerSigning::Config","","TrueLayerSigning/Config.html","",""],["TrueLayerSigning::Error","","TrueLayerSigning/Error.html","",""],["TrueLayerSigning::JwsBase","","TrueLayerSigning/JwsBase.html","",""],["TrueLayerSigning::JwsHeader","","TrueLayerSigning/JwsHeader.html","",""],["TrueLayerSigning::Signer","","TrueLayerSigning/Signer.html","",""],["TrueLayerSigning::Verifier","","TrueLayerSigning/Verifier.html","",""],["TrueLayerSigningExamples","","TrueLayerSigningExamples.html","",""],["add_header","TrueLayerSigning::JwsBase","TrueLayerSigning/JwsBase.html#method-i-add_header","(name, value)",""],["create_ec_key","JWT::JWK::EC","JWT/JWK/EC.html#method-i-create_ec_key","(jwk_crv, jwk_x, jwk_y, jwk_d)",""],["extract_jws_header","TrueLayerSigning","TrueLayerSigning.html#method-c-extract_jws_header","(signature)",""],["filter_headers","TrueLayerSigning::JwsHeader","TrueLayerSigning/JwsHeader.html#method-i-filter_headers","(headers)",""],["new","TrueLayerSigning::Config","TrueLayerSigning/Config.html#method-c-new","()","<p>@return [TrueLayerSigning::Config]\n"],["new","TrueLayerSigning::JwsBase","TrueLayerSigning/JwsBase.html#method-c-new","(args = {})",""],["new","TrueLayerSigning::JwsHeader","TrueLayerSigning/JwsHeader.html#method-c-new","(args = {})",""],["new","TrueLayerSigning::Verifier","TrueLayerSigning/Verifier.html#method-c-new","(args)",""],["parse_tl_signature","TrueLayerSigning::Verifier","TrueLayerSigning/Verifier.html#method-c-parse_tl_signature","(tl_signature)",""],["require_header","TrueLayerSigning::Verifier","TrueLayerSigning/Verifier.html#method-i-require_header","(name)",""],["require_headers","TrueLayerSigning::Verifier","TrueLayerSigning/Verifier.html#method-i-require_headers","(names)",""],["run_webhook_server","TrueLayerSigningExamples","TrueLayerSigningExamples.html#method-c-run_webhook_server","()",""],["set_body","TrueLayerSigning::JwsBase","TrueLayerSigning/JwsBase.html#method-i-set_body","(body)",""],["set_headers","TrueLayerSigning::JwsBase","TrueLayerSigning/JwsBase.html#method-i-set_headers","(headers)",""],["set_jku","TrueLayerSigning::Signer","TrueLayerSigning/Signer.html#method-i-set_jku","(jku)",""],["set_method","TrueLayerSigning::JwsBase","TrueLayerSigning/JwsBase.html#method-i-set_method","(method)",""],["set_path","TrueLayerSigning::JwsBase","TrueLayerSigning/JwsBase.html#method-i-set_path","(path)",""],["setup","TrueLayerSigning::Config","TrueLayerSigning/Config.html#method-c-setup","()","<p>@return [TrueLayerSigning::Config]\n"],["sign","TrueLayerSigning::Signer","TrueLayerSigning/Signer.html#method-i-sign","()",""],["sign_with_pem","TrueLayerSigning","TrueLayerSigning.html#method-c-sign_with_pem","()",""],["test_signature_endpoint","TrueLayerSigningExamples","TrueLayerSigningExamples.html#method-c-test_signature_endpoint","()",""],["to_h","TrueLayerSigning::JwsHeader","TrueLayerSigning/JwsHeader.html#method-i-to_h","()",""],["verify","TrueLayerSigning::Verifier","TrueLayerSigning/Verifier.html#method-i-verify","(tl_signature)",""],["verify_with_jwks","TrueLayerSigning","TrueLayerSigning.html#method-c-verify_with_jwks","(jwks)",""],["verify_with_pem","TrueLayerSigning","TrueLayerSigning.html#method-c-verify_with_pem","(pem)",""],["CHANGELOG","","CHANGELOG_md.html","","<p>Changelog\n<p>All notable changes to this project will be documented in this file.\n<p>The format is based on …\n"],["LICENSE-APACHE","","LICENSE-APACHE.html","","\n<pre> Apache License\n Version 2.0, January 2004\nhttp://www.apache.org/licenses/</pre>\n<p>TERMS AND CONDITIONS …\n"],["LICENSE-MIT","","LICENSE-MIT.html","","<p>MIT License\n<p>Copyright © 2021 TrueLayer\n<p>Permission is hereby granted, free of charge, to any person obtaining …\n"],["README","","README_md.html","","<p>truelayer-signing\n<p>Ruby gem to produce and verify TrueLayer API requests signatures.\n<p>Installation\n"],["Rakefile","","Rakefile.html","","<p>require “rake/testtask”\n<p>Rake::TestTask.new do |t|\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">t</span>.<span class=\"ruby-identifier\">libs</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-string\">"test"</span>\n</pre>\n"],["Gemfile","","examples/sign-request/Gemfile.html","","<p>source “rubygems.org”\n<p>gem “http” gem “truelayer-signing”\n"],["Gemfile.lock","","examples/sign-request/Gemfile_lock.html","","<p>GEM\n\n<pre>remote: https://rubygems.org/\nspecs:\n addressable (2.8.1)\n public_suffix (>= 2.0.2, < 6.0)\n domain_name ...</pre>\n"],["README","","examples/sign-request/README_md.html","","<p>Ruby request signature example\n<p>Sends a signed request to <code>https://api.truelayer-sandbox.com/test-signature</code> …\n"],["Gemfile","","examples/webhook-server/Gemfile.html","","<p>source “rubygems.org”\n<p>gem “http” gem “truelayer-signing”\n"],["Gemfile.lock","","examples/webhook-server/Gemfile_lock.html","","<p>GEM\n\n<pre>remote: https://rubygems.org/\nspecs:\n addressable (2.8.1)\n public_suffix (>= 2.0.2, < 6.0)\n domain_name ...</pre>\n"],["README","","examples/webhook-server/README_md.html","","<p>Ruby webhook server example\n<p>An HTTP server that can receive and verify signed TrueLayer webhooks.\n<p>Run\n"]]}}
|