bfdotcom-theme 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/comments.html +35 -0
- data/_includes/head.html +22 -0
- data/_layouts/default.html +1 -0
- data/_layouts/post.html +4 -0
- data/assets/auth/signin.html +10 -0
- data/assets/scripts/CryptoJS/components/enc-base64.js +109 -0
- data/assets/scripts/CryptoJS/components/hmac.js +131 -0
- data/assets/scripts/CryptoJS/rollups/hmac-sha256.js +18 -0
- data/assets/scripts/CryptoJS/rollups/sha256.js +16 -0
- data/assets/scripts/apiGatewayCore/apiGatewayClient.js +53 -0
- data/assets/scripts/apiGatewayCore/sigV4Client.js +219 -0
- data/assets/scripts/apiGatewayCore/simpleHttpClient.js +81 -0
- data/assets/scripts/apiGatewayCore/utils.js +80 -0
- data/assets/scripts/axios/dist/axios.standalone.js +1089 -0
- data/assets/scripts/core.js +93 -0
- data/assets/scripts/signin.js +16 -0
- data/assets/scripts/url-template/url-template.js +438 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b307871ae94ef6c5f37e65d06a10b98a0da709401ae16c960a5d4987256559f
|
4
|
+
data.tar.gz: 692196cef73290108fa15fe883bffced161a63a5f6212e9173a1e4eb9fdece62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3029742e40147eb6794d9e0d4c079aabdbd66e63d8e0e270543abba8aea7dd0d8cfe332a239d9b6e6b7d4eebd86dcd29f8919cf79ba6d946b52152bf7650f555
|
7
|
+
data.tar.gz: ec71111e94e984cc51ff2edcdaf1a23a8c62e9e4eb0fe6966cd2a4f2c9502022a3700046d4f66195ccc4eef06a5b6f88ab418ac6539f196e73a706dc9db1914f
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{%- assign comments = site.data.comments | where: "url", page.url -%}
|
2
|
+
{%- assign comments_size = comments | size -%}
|
3
|
+
|
4
|
+
<h3 class="display-4">Comments</h3>
|
5
|
+
|
6
|
+
<div class="showSignedOut row">
|
7
|
+
<div class="col">
|
8
|
+
<a href="#" onclick="startLogin();">Sign in to leave a comment</a>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="showSignedIn row">
|
13
|
+
<div class="col">
|
14
|
+
You're signed in as <span id="currentUserName"></span>, and the new comment form is coming soon, I promise!
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
{%- if comments_size > 0 -%}
|
19
|
+
<div class="row">
|
20
|
+
{%- for comment in comments -%}
|
21
|
+
|
22
|
+
<div class="col-md-1">
|
23
|
+
<img src="https://www.gravatar.com/avatar/{{comment.emailHash}}" alt="Profile image for {{comment.name}}" />
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="col-md-11">
|
27
|
+
<strong>{{comment.name}}</strong> <small>{{comment.datetime}}</small><br />
|
28
|
+
{{comment.comment}}
|
29
|
+
</div>
|
30
|
+
|
31
|
+
{%- endfor -%}
|
32
|
+
</div>
|
33
|
+
{%- endif -%}
|
34
|
+
|
35
|
+
<p> </p>
|
data/_includes/head.html
CHANGED
@@ -2,9 +2,31 @@
|
|
2
2
|
<meta charset="utf-8">
|
3
3
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
4
4
|
|
5
|
+
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.512.0.min.js"></script>
|
6
|
+
|
7
|
+
<script type="text/javascript" src="/assets/scripts/axios/dist/axios.standalone.js"></script>
|
8
|
+
<script type="text/javascript" src="/assets/scripts/CryptoJS/rollups/hmac-sha256.js"></script>
|
9
|
+
<script type="text/javascript" src="/assets/scripts/CryptoJS/rollups/sha256.js"></script>
|
10
|
+
<script type="text/javascript" src="/assets/scripts/CryptoJS/components/hmac.js"></script>
|
11
|
+
<script type="text/javascript" src="/assets/scripts/CryptoJS/components/enc-base64.js"></script>
|
12
|
+
<script type="text/javascript" src="/assets/scripts/url-template/url-template.js"></script>
|
13
|
+
<script type="text/javascript" src="/assets/scripts/apiGatewayCore/sigV4Client.js"></script>
|
14
|
+
<script type="text/javascript" src="/assets/scripts/apiGatewayCore/apiGatewayClient.js"></script>
|
15
|
+
<script type="text/javascript" src="/assets/scripts/apiGatewayCore/simpleHttpClient.js"></script>
|
16
|
+
<script type="text/javascript" src="/assets/scripts/apiGatewayCore/utils.js"></script>
|
17
|
+
|
5
18
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
6
19
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
7
20
|
|
8
21
|
<link rel="stylesheet" href="{{ "/assets/css/style.css" | relative_url }}">
|
9
22
|
{%- seo -%}
|
23
|
+
|
24
|
+
<script type="text/javascript">
|
25
|
+
var api_gateway_url = "{{site.api_gateway_url}}"
|
26
|
+
var user_pool_id = "{{site.user_pool_id}}"
|
27
|
+
var identity_pool_id = "{{site.identity_pool_id}}"
|
28
|
+
var user_pool_client_id = "{{site.user_pool_client_id}}"
|
29
|
+
var aws_region = "{{site.aws_region}}"
|
30
|
+
var auth_url = "{{site.auth_url}}"
|
31
|
+
</script>
|
10
32
|
</head>
|
data/_layouts/default.html
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
15
15
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
16
16
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
17
|
+
<script src="/assets/scripts/core.js" type="application/javascript"></script>
|
17
18
|
</body>
|
18
19
|
</html>
|
19
20
|
|
data/_layouts/post.html
CHANGED
@@ -0,0 +1,109 @@
|
|
1
|
+
/*
|
2
|
+
CryptoJS v3.1.2
|
3
|
+
code.google.com/p/crypto-js
|
4
|
+
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
5
|
+
code.google.com/p/crypto-js/wiki/License
|
6
|
+
*/
|
7
|
+
(function () {
|
8
|
+
// Shortcuts
|
9
|
+
var C = CryptoJS;
|
10
|
+
var C_lib = C.lib;
|
11
|
+
var WordArray = C_lib.WordArray;
|
12
|
+
var C_enc = C.enc;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Base64 encoding strategy.
|
16
|
+
*/
|
17
|
+
var Base64 = C_enc.Base64 = {
|
18
|
+
/**
|
19
|
+
* Converts a word array to a Base64 string.
|
20
|
+
*
|
21
|
+
* @param {WordArray} wordArray The word array.
|
22
|
+
*
|
23
|
+
* @return {string} The Base64 string.
|
24
|
+
*
|
25
|
+
* @static
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
*
|
29
|
+
* var base64String = CryptoJS.enc.Base64.stringify(wordArray);
|
30
|
+
*/
|
31
|
+
stringify: function (wordArray) {
|
32
|
+
// Shortcuts
|
33
|
+
var words = wordArray.words;
|
34
|
+
var sigBytes = wordArray.sigBytes;
|
35
|
+
var map = this._map;
|
36
|
+
|
37
|
+
// Clamp excess bits
|
38
|
+
wordArray.clamp();
|
39
|
+
|
40
|
+
// Convert
|
41
|
+
var base64Chars = [];
|
42
|
+
for (var i = 0; i < sigBytes; i += 3) {
|
43
|
+
var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
44
|
+
var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
|
45
|
+
var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
|
46
|
+
|
47
|
+
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
48
|
+
|
49
|
+
for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
50
|
+
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
// Add padding
|
55
|
+
var paddingChar = map.charAt(64);
|
56
|
+
if (paddingChar) {
|
57
|
+
while (base64Chars.length % 4) {
|
58
|
+
base64Chars.push(paddingChar);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
return base64Chars.join('');
|
63
|
+
},
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Converts a Base64 string to a word array.
|
67
|
+
*
|
68
|
+
* @param {string} base64Str The Base64 string.
|
69
|
+
*
|
70
|
+
* @return {WordArray} The word array.
|
71
|
+
*
|
72
|
+
* @static
|
73
|
+
*
|
74
|
+
* @example
|
75
|
+
*
|
76
|
+
* var wordArray = CryptoJS.enc.Base64.parse(base64String);
|
77
|
+
*/
|
78
|
+
parse: function (base64Str) {
|
79
|
+
// Shortcuts
|
80
|
+
var base64StrLength = base64Str.length;
|
81
|
+
var map = this._map;
|
82
|
+
|
83
|
+
// Ignore padding
|
84
|
+
var paddingChar = map.charAt(64);
|
85
|
+
if (paddingChar) {
|
86
|
+
var paddingIndex = base64Str.indexOf(paddingChar);
|
87
|
+
if (paddingIndex != -1) {
|
88
|
+
base64StrLength = paddingIndex;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
// Convert
|
93
|
+
var words = [];
|
94
|
+
var nBytes = 0;
|
95
|
+
for (var i = 0; i < base64StrLength; i++) {
|
96
|
+
if (i % 4) {
|
97
|
+
var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2);
|
98
|
+
var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2);
|
99
|
+
words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
|
100
|
+
nBytes++;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
return WordArray.create(words, nBytes);
|
105
|
+
},
|
106
|
+
|
107
|
+
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
108
|
+
};
|
109
|
+
}());
|
@@ -0,0 +1,131 @@
|
|
1
|
+
/*
|
2
|
+
CryptoJS v3.1.2
|
3
|
+
code.google.com/p/crypto-js
|
4
|
+
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
5
|
+
code.google.com/p/crypto-js/wiki/License
|
6
|
+
*/
|
7
|
+
(function () {
|
8
|
+
// Shortcuts
|
9
|
+
var C = CryptoJS;
|
10
|
+
var C_lib = C.lib;
|
11
|
+
var Base = C_lib.Base;
|
12
|
+
var C_enc = C.enc;
|
13
|
+
var Utf8 = C_enc.Utf8;
|
14
|
+
var C_algo = C.algo;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* HMAC algorithm.
|
18
|
+
*/
|
19
|
+
var HMAC = C_algo.HMAC = Base.extend({
|
20
|
+
/**
|
21
|
+
* Initializes a newly created HMAC.
|
22
|
+
*
|
23
|
+
* @param {Hasher} hasher The hash algorithm to use.
|
24
|
+
* @param {WordArray|string} key The secret key.
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
*
|
28
|
+
* var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
|
29
|
+
*/
|
30
|
+
init: function (hasher, key) {
|
31
|
+
// Init hasher
|
32
|
+
hasher = this._hasher = new hasher.init();
|
33
|
+
|
34
|
+
// Convert string to WordArray, else assume WordArray already
|
35
|
+
if (typeof key == 'string') {
|
36
|
+
key = Utf8.parse(key);
|
37
|
+
}
|
38
|
+
|
39
|
+
// Shortcuts
|
40
|
+
var hasherBlockSize = hasher.blockSize;
|
41
|
+
var hasherBlockSizeBytes = hasherBlockSize * 4;
|
42
|
+
|
43
|
+
// Allow arbitrary length keys
|
44
|
+
if (key.sigBytes > hasherBlockSizeBytes) {
|
45
|
+
key = hasher.finalize(key);
|
46
|
+
}
|
47
|
+
|
48
|
+
// Clamp excess bits
|
49
|
+
key.clamp();
|
50
|
+
|
51
|
+
// Clone key for inner and outer pads
|
52
|
+
var oKey = this._oKey = key.clone();
|
53
|
+
var iKey = this._iKey = key.clone();
|
54
|
+
|
55
|
+
// Shortcuts
|
56
|
+
var oKeyWords = oKey.words;
|
57
|
+
var iKeyWords = iKey.words;
|
58
|
+
|
59
|
+
// XOR keys with pad constants
|
60
|
+
for (var i = 0; i < hasherBlockSize; i++) {
|
61
|
+
oKeyWords[i] ^= 0x5c5c5c5c;
|
62
|
+
iKeyWords[i] ^= 0x36363636;
|
63
|
+
}
|
64
|
+
oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
|
65
|
+
|
66
|
+
// Set initial values
|
67
|
+
this.reset();
|
68
|
+
},
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Resets this HMAC to its initial state.
|
72
|
+
*
|
73
|
+
* @example
|
74
|
+
*
|
75
|
+
* hmacHasher.reset();
|
76
|
+
*/
|
77
|
+
reset: function () {
|
78
|
+
// Shortcut
|
79
|
+
var hasher = this._hasher;
|
80
|
+
|
81
|
+
// Reset
|
82
|
+
hasher.reset();
|
83
|
+
hasher.update(this._iKey);
|
84
|
+
},
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Updates this HMAC with a message.
|
88
|
+
*
|
89
|
+
* @param {WordArray|string} messageUpdate The message to append.
|
90
|
+
*
|
91
|
+
* @return {HMAC} This HMAC instance.
|
92
|
+
*
|
93
|
+
* @example
|
94
|
+
*
|
95
|
+
* hmacHasher.update('message');
|
96
|
+
* hmacHasher.update(wordArray);
|
97
|
+
*/
|
98
|
+
update: function (messageUpdate) {
|
99
|
+
this._hasher.update(messageUpdate);
|
100
|
+
|
101
|
+
// Chainable
|
102
|
+
return this;
|
103
|
+
},
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Finalizes the HMAC computation.
|
107
|
+
* Note that the finalize operation is effectively a destructive, read-once operation.
|
108
|
+
*
|
109
|
+
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
110
|
+
*
|
111
|
+
* @return {WordArray} The HMAC.
|
112
|
+
*
|
113
|
+
* @example
|
114
|
+
*
|
115
|
+
* var hmac = hmacHasher.finalize();
|
116
|
+
* var hmac = hmacHasher.finalize('message');
|
117
|
+
* var hmac = hmacHasher.finalize(wordArray);
|
118
|
+
*/
|
119
|
+
finalize: function (messageUpdate) {
|
120
|
+
// Shortcut
|
121
|
+
var hasher = this._hasher;
|
122
|
+
|
123
|
+
// Compute HMAC
|
124
|
+
var innerHash = hasher.finalize(messageUpdate);
|
125
|
+
hasher.reset();
|
126
|
+
var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
|
127
|
+
|
128
|
+
return hmac;
|
129
|
+
}
|
130
|
+
});
|
131
|
+
}());
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/*
|
2
|
+
CryptoJS v3.1.2
|
3
|
+
code.google.com/p/crypto-js
|
4
|
+
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
5
|
+
code.google.com/p/crypto-js/wiki/License
|
6
|
+
*/
|
7
|
+
var CryptoJS=CryptoJS||function(h,s){var f={},g=f.lib={},q=function(){},m=g.Base={extend:function(a){q.prototype=this;var c=new q;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
|
8
|
+
r=g.WordArray=m.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||k).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e<a;e++)c[b+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)c[b+e>>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<
|
9
|
+
32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d<a;d+=4)c.push(4294967296*h.random()|0);return new r.init(c,a)}}),l=f.enc={},k=l.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++){var e=c[b>>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b+=2)d[b>>>3]|=parseInt(a.substr(b,
|
10
|
+
2),16)<<24-4*(b%8);return new r.init(d,c/2)}},n=l.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++)d.push(String.fromCharCode(c[b>>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b++)d[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(d,c)}},j=l.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}},
|
11
|
+
u=g.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);c.sigBytes-=b}return new r.init(g,b)},clone:function(){var a=m.clone.call(this);
|
12
|
+
a._data=this._data.clone();return a},_minBufferSize:0});g.Hasher=u.extend({cfg:m.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){u.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,d){return(new a.init(d)).finalize(c)}},_createHmacHelper:function(a){return function(c,d){return(new t.HMAC.init(a,
|
13
|
+
d)).finalize(c)}}});var t=f.algo={};return f}(Math);
|
14
|
+
(function(h){for(var s=CryptoJS,f=s.lib,g=f.WordArray,q=f.Hasher,f=s.algo,m=[],r=[],l=function(a){return 4294967296*(a-(a|0))|0},k=2,n=0;64>n;){var j;a:{j=k;for(var u=h.sqrt(j),t=2;t<=u;t++)if(!(j%t)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=l(h.pow(k,0.5))),r[n]=l(h.pow(k,1/3)),n++);k++}var a=[],f=f.SHA256=q.extend({_doReset:function(){this._hash=new g.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],j=b[3],h=b[4],m=b[5],n=b[6],q=b[7],p=0;64>p;p++){if(16>p)a[p]=
|
15
|
+
c[d+p]|0;else{var k=a[p-15],l=a[p-2];a[p]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[p-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[p-16]}k=q+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&m^~h&n)+r[p]+a[p];l=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);q=n;n=m;m=h;h=j+k|0;j=g;g=f;f=e;e=k+l|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+m|0;b[6]=b[6]+n|0;b[7]=b[7]+q|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;
|
16
|
+
d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=q.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=q._createHelper(f);s.HmacSHA256=q._createHmacHelper(f)})(Math);
|
17
|
+
(function(){var h=CryptoJS,s=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(f,g){f=this._hasher=new f.init;"string"==typeof g&&(g=s.parse(g));var h=f.blockSize,m=4*h;g.sigBytes>m&&(g=f.finalize(g));g.clamp();for(var r=this._oKey=g.clone(),l=this._iKey=g.clone(),k=r.words,n=l.words,j=0;j<h;j++)k[j]^=1549556828,n[j]^=909522486;r.sigBytes=l.sigBytes=m;this.reset()},reset:function(){var f=this._hasher;f.reset();f.update(this._iKey)},update:function(f){this._hasher.update(f);return this},finalize:function(f){var g=
|
18
|
+
this._hasher;f=g.finalize(f);g.reset();return g.finalize(this._oKey.clone().concat(f))}})})();
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
CryptoJS v3.1.2
|
3
|
+
code.google.com/p/crypto-js
|
4
|
+
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
5
|
+
code.google.com/p/crypto-js/wiki/License
|
6
|
+
*/
|
7
|
+
var CryptoJS=CryptoJS||function(h,s){var f={},t=f.lib={},g=function(){},j=t.Base={extend:function(a){g.prototype=this;var c=new g;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
|
8
|
+
q=t.WordArray=j.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||u).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e<a;e++)c[b+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)c[b+e>>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<
|
9
|
+
32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=j.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d<a;d+=4)c.push(4294967296*h.random()|0);return new q.init(c,a)}}),v=f.enc={},u=v.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++){var e=c[b>>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b+=2)d[b>>>3]|=parseInt(a.substr(b,
|
10
|
+
2),16)<<24-4*(b%8);return new q.init(d,c/2)}},k=v.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++)d.push(String.fromCharCode(c[b>>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b++)d[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},l=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(k.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return k.parse(unescape(encodeURIComponent(a)))}},
|
11
|
+
x=t.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=l.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var m=0;m<a;m+=e)this._doProcessBlock(d,m);m=d.splice(0,a);c.sigBytes-=b}return new q.init(m,b)},clone:function(){var a=j.clone.call(this);
|
12
|
+
a._data=this._data.clone();return a},_minBufferSize:0});t.Hasher=x.extend({cfg:j.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){x.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,d){return(new a.init(d)).finalize(c)}},_createHmacHelper:function(a){return function(c,d){return(new w.HMAC.init(a,
|
13
|
+
d)).finalize(c)}}});var w=f.algo={};return f}(Math);
|
14
|
+
(function(h){for(var s=CryptoJS,f=s.lib,t=f.WordArray,g=f.Hasher,f=s.algo,j=[],q=[],v=function(a){return 4294967296*(a-(a|0))|0},u=2,k=0;64>k;){var l;a:{l=u;for(var x=h.sqrt(l),w=2;w<=x;w++)if(!(l%w)){l=!1;break a}l=!0}l&&(8>k&&(j[k]=v(h.pow(u,0.5))),q[k]=v(h.pow(u,1/3)),k++);u++}var a=[],f=f.SHA256=g.extend({_doReset:function(){this._hash=new t.init(j.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],m=b[2],h=b[3],p=b[4],j=b[5],k=b[6],l=b[7],n=0;64>n;n++){if(16>n)a[n]=
|
15
|
+
c[d+n]|0;else{var r=a[n-15],g=a[n-2];a[n]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+a[n-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+a[n-16]}r=l+((p<<26|p>>>6)^(p<<21|p>>>11)^(p<<7|p>>>25))+(p&j^~p&k)+q[n]+a[n];g=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&m^f&m);l=k;k=j;j=p;p=h+r|0;h=m;m=f;f=e;e=r+g|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+m|0;b[3]=b[3]+h|0;b[4]=b[4]+p|0;b[5]=b[5]+j|0;b[6]=b[6]+k|0;b[7]=b[7]+l|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;
|
16
|
+
d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=g.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=g._createHelper(f);s.HmacSHA256=g._createHmacHelper(f)})(Math);
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
5
|
+
* You may not use this file except in compliance with the License.
|
6
|
+
* A copy of the License is located at
|
7
|
+
*
|
8
|
+
* http://aws.amazon.com/apache2.0
|
9
|
+
*
|
10
|
+
* or in the "license" file accompanying this file. This file is distributed
|
11
|
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
12
|
+
* express or implied. See the License for the specific language governing
|
13
|
+
* permissions and limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var apiGateway = apiGateway || {};
|
17
|
+
apiGateway.core = apiGateway.core || {};
|
18
|
+
|
19
|
+
apiGateway.core.apiGatewayClientFactory = {};
|
20
|
+
apiGateway.core.apiGatewayClientFactory.newClient = function (simpleHttpClientConfig, sigV4ClientConfig) {
|
21
|
+
var apiGatewayClient = { };
|
22
|
+
//Spin up 2 httpClients, one for simple requests, one for SigV4
|
23
|
+
var sigV4Client = apiGateway.core.sigV4ClientFactory.newClient(sigV4ClientConfig);
|
24
|
+
var simpleHttpClient = apiGateway.core.simpleHttpClientFactory.newClient(simpleHttpClientConfig);
|
25
|
+
|
26
|
+
apiGatewayClient.makeRequest = function (request, authType, additionalParams, apiKey) {
|
27
|
+
//Default the request to use the simple http client
|
28
|
+
var clientToUse = simpleHttpClient;
|
29
|
+
|
30
|
+
//Attach the apiKey to the headers request if one was provided
|
31
|
+
if (apiKey !== undefined && apiKey !== '' && apiKey !== null) {
|
32
|
+
request.headers['x-api-key'] = apiKey;
|
33
|
+
}
|
34
|
+
|
35
|
+
if (request.body === undefined || request.body === '' || request.body === null || Object.keys(request.body).length === 0) {
|
36
|
+
request.body = undefined;
|
37
|
+
}
|
38
|
+
|
39
|
+
// If the user specified any additional headers or query params that may not have been modeled
|
40
|
+
// merge them into the appropriate request properties
|
41
|
+
request.headers = apiGateway.core.utils.mergeInto(request.headers, additionalParams.headers);
|
42
|
+
request.queryParams = apiGateway.core.utils.mergeInto(request.queryParams, additionalParams.queryParams);
|
43
|
+
|
44
|
+
//If an auth type was specified inject the appropriate auth client
|
45
|
+
if (authType === 'AWS_IAM') {
|
46
|
+
clientToUse = sigV4Client;
|
47
|
+
}
|
48
|
+
|
49
|
+
//Call the selected http client to make the request, returning a promise once the request is sent
|
50
|
+
return clientToUse.makeRequest(request);
|
51
|
+
};
|
52
|
+
return apiGatewayClient;
|
53
|
+
};
|