Initial
This commit is contained in:
201
resources/app/node_modules/@smithy/signature-v4/LICENSE
generated
vendored
Normal file
201
resources/app/node_modules/@smithy/signature-v4/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/HeaderFormatter.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/HeaderFormatter.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/SignatureV4.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/SignatureV4.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/cloneRequest.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/cloneRequest.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/constants.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/constants.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/credentialDerivation.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/credentialDerivation.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/getCanonicalHeaders.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/getCanonicalHeaders.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/getCanonicalQuery.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/getCanonicalQuery.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/getPayloadHash.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/getPayloadHash.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/headerUtil.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/headerUtil.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
589
resources/app/node_modules/@smithy/signature-v4/dist-cjs/index.js
generated
vendored
Normal file
589
resources/app/node_modules/@smithy/signature-v4/dist-cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,589 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
SignatureV4: () => SignatureV4,
|
||||
clearCredentialCache: () => clearCredentialCache,
|
||||
createScope: () => createScope,
|
||||
getCanonicalHeaders: () => getCanonicalHeaders,
|
||||
getCanonicalQuery: () => getCanonicalQuery,
|
||||
getPayloadHash: () => getPayloadHash,
|
||||
getSigningKey: () => getSigningKey,
|
||||
moveHeadersToQuery: () => moveHeadersToQuery,
|
||||
prepareRequest: () => prepareRequest
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
|
||||
// src/SignatureV4.ts
|
||||
|
||||
var import_util_middleware = require("@smithy/util-middleware");
|
||||
|
||||
var import_util_utf84 = require("@smithy/util-utf8");
|
||||
|
||||
// src/constants.ts
|
||||
var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
||||
var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
||||
var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
|
||||
var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
|
||||
var EXPIRES_QUERY_PARAM = "X-Amz-Expires";
|
||||
var SIGNATURE_QUERY_PARAM = "X-Amz-Signature";
|
||||
var TOKEN_QUERY_PARAM = "X-Amz-Security-Token";
|
||||
var AUTH_HEADER = "authorization";
|
||||
var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();
|
||||
var DATE_HEADER = "date";
|
||||
var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];
|
||||
var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();
|
||||
var SHA256_HEADER = "x-amz-content-sha256";
|
||||
var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();
|
||||
var ALWAYS_UNSIGNABLE_HEADERS = {
|
||||
authorization: true,
|
||||
"cache-control": true,
|
||||
connection: true,
|
||||
expect: true,
|
||||
from: true,
|
||||
"keep-alive": true,
|
||||
"max-forwards": true,
|
||||
pragma: true,
|
||||
referer: true,
|
||||
te: true,
|
||||
trailer: true,
|
||||
"transfer-encoding": true,
|
||||
upgrade: true,
|
||||
"user-agent": true,
|
||||
"x-amzn-trace-id": true
|
||||
};
|
||||
var PROXY_HEADER_PATTERN = /^proxy-/;
|
||||
var SEC_HEADER_PATTERN = /^sec-/;
|
||||
var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
|
||||
var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD";
|
||||
var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
|
||||
var MAX_CACHE_SIZE = 50;
|
||||
var KEY_TYPE_IDENTIFIER = "aws4_request";
|
||||
var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
|
||||
|
||||
// src/credentialDerivation.ts
|
||||
var import_util_hex_encoding = require("@smithy/util-hex-encoding");
|
||||
var import_util_utf8 = require("@smithy/util-utf8");
|
||||
var signingKeyCache = {};
|
||||
var cacheQueue = [];
|
||||
var createScope = /* @__PURE__ */ __name((shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`, "createScope");
|
||||
var getSigningKey = /* @__PURE__ */ __name(async (sha256Constructor, credentials, shortDate, region, service) => {
|
||||
const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId);
|
||||
const cacheKey = `${shortDate}:${region}:${service}:${(0, import_util_hex_encoding.toHex)(credsHash)}:${credentials.sessionToken}`;
|
||||
if (cacheKey in signingKeyCache) {
|
||||
return signingKeyCache[cacheKey];
|
||||
}
|
||||
cacheQueue.push(cacheKey);
|
||||
while (cacheQueue.length > MAX_CACHE_SIZE) {
|
||||
delete signingKeyCache[cacheQueue.shift()];
|
||||
}
|
||||
let key = `AWS4${credentials.secretAccessKey}`;
|
||||
for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) {
|
||||
key = await hmac(sha256Constructor, key, signable);
|
||||
}
|
||||
return signingKeyCache[cacheKey] = key;
|
||||
}, "getSigningKey");
|
||||
var clearCredentialCache = /* @__PURE__ */ __name(() => {
|
||||
cacheQueue.length = 0;
|
||||
Object.keys(signingKeyCache).forEach((cacheKey) => {
|
||||
delete signingKeyCache[cacheKey];
|
||||
});
|
||||
}, "clearCredentialCache");
|
||||
var hmac = /* @__PURE__ */ __name((ctor, secret, data) => {
|
||||
const hash = new ctor(secret);
|
||||
hash.update((0, import_util_utf8.toUint8Array)(data));
|
||||
return hash.digest();
|
||||
}, "hmac");
|
||||
|
||||
// src/getCanonicalHeaders.ts
|
||||
var getCanonicalHeaders = /* @__PURE__ */ __name(({ headers }, unsignableHeaders, signableHeaders) => {
|
||||
const canonical = {};
|
||||
for (const headerName of Object.keys(headers).sort()) {
|
||||
if (headers[headerName] == void 0) {
|
||||
continue;
|
||||
}
|
||||
const canonicalHeaderName = headerName.toLowerCase();
|
||||
if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
|
||||
if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " ");
|
||||
}
|
||||
return canonical;
|
||||
}, "getCanonicalHeaders");
|
||||
|
||||
// src/getCanonicalQuery.ts
|
||||
var import_util_uri_escape = require("@smithy/util-uri-escape");
|
||||
var getCanonicalQuery = /* @__PURE__ */ __name(({ query = {} }) => {
|
||||
const keys = [];
|
||||
const serialized = {};
|
||||
for (const key of Object.keys(query).sort()) {
|
||||
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
||||
continue;
|
||||
}
|
||||
keys.push(key);
|
||||
const value = query[key];
|
||||
if (typeof value === "string") {
|
||||
serialized[key] = `${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value)}`;
|
||||
} else if (Array.isArray(value)) {
|
||||
serialized[key] = value.slice(0).reduce(
|
||||
(encoded, value2) => encoded.concat([`${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value2)}`]),
|
||||
[]
|
||||
).sort().join("&");
|
||||
}
|
||||
}
|
||||
return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
|
||||
}, "getCanonicalQuery");
|
||||
|
||||
// src/getPayloadHash.ts
|
||||
var import_is_array_buffer = require("@smithy/is-array-buffer");
|
||||
|
||||
var import_util_utf82 = require("@smithy/util-utf8");
|
||||
var getPayloadHash = /* @__PURE__ */ __name(async ({ headers, body }, hashConstructor) => {
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
if (headerName.toLowerCase() === SHA256_HEADER) {
|
||||
return headers[headerName];
|
||||
}
|
||||
}
|
||||
if (body == void 0) {
|
||||
return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
|
||||
} else if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) {
|
||||
const hashCtor = new hashConstructor();
|
||||
hashCtor.update((0, import_util_utf82.toUint8Array)(body));
|
||||
return (0, import_util_hex_encoding.toHex)(await hashCtor.digest());
|
||||
}
|
||||
return UNSIGNED_PAYLOAD;
|
||||
}, "getPayloadHash");
|
||||
|
||||
// src/HeaderFormatter.ts
|
||||
|
||||
var import_util_utf83 = require("@smithy/util-utf8");
|
||||
var _HeaderFormatter = class _HeaderFormatter {
|
||||
format(headers) {
|
||||
const chunks = [];
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
const bytes = (0, import_util_utf83.fromUtf8)(headerName);
|
||||
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
||||
}
|
||||
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
||||
let position = 0;
|
||||
for (const chunk of chunks) {
|
||||
out.set(chunk, position);
|
||||
position += chunk.byteLength;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
formatHeaderValue(header) {
|
||||
switch (header.type) {
|
||||
case "boolean":
|
||||
return Uint8Array.from([header.value ? 0 /* boolTrue */ : 1 /* boolFalse */]);
|
||||
case "byte":
|
||||
return Uint8Array.from([2 /* byte */, header.value]);
|
||||
case "short":
|
||||
const shortView = new DataView(new ArrayBuffer(3));
|
||||
shortView.setUint8(0, 3 /* short */);
|
||||
shortView.setInt16(1, header.value, false);
|
||||
return new Uint8Array(shortView.buffer);
|
||||
case "integer":
|
||||
const intView = new DataView(new ArrayBuffer(5));
|
||||
intView.setUint8(0, 4 /* integer */);
|
||||
intView.setInt32(1, header.value, false);
|
||||
return new Uint8Array(intView.buffer);
|
||||
case "long":
|
||||
const longBytes = new Uint8Array(9);
|
||||
longBytes[0] = 5 /* long */;
|
||||
longBytes.set(header.value.bytes, 1);
|
||||
return longBytes;
|
||||
case "binary":
|
||||
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
||||
binView.setUint8(0, 6 /* byteArray */);
|
||||
binView.setUint16(1, header.value.byteLength, false);
|
||||
const binBytes = new Uint8Array(binView.buffer);
|
||||
binBytes.set(header.value, 3);
|
||||
return binBytes;
|
||||
case "string":
|
||||
const utf8Bytes = (0, import_util_utf83.fromUtf8)(header.value);
|
||||
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
||||
strView.setUint8(0, 7 /* string */);
|
||||
strView.setUint16(1, utf8Bytes.byteLength, false);
|
||||
const strBytes = new Uint8Array(strView.buffer);
|
||||
strBytes.set(utf8Bytes, 3);
|
||||
return strBytes;
|
||||
case "timestamp":
|
||||
const tsBytes = new Uint8Array(9);
|
||||
tsBytes[0] = 8 /* timestamp */;
|
||||
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
||||
return tsBytes;
|
||||
case "uuid":
|
||||
if (!UUID_PATTERN.test(header.value)) {
|
||||
throw new Error(`Invalid UUID received: ${header.value}`);
|
||||
}
|
||||
const uuidBytes = new Uint8Array(17);
|
||||
uuidBytes[0] = 9 /* uuid */;
|
||||
uuidBytes.set((0, import_util_hex_encoding.fromHex)(header.value.replace(/\-/g, "")), 1);
|
||||
return uuidBytes;
|
||||
}
|
||||
}
|
||||
};
|
||||
__name(_HeaderFormatter, "HeaderFormatter");
|
||||
var HeaderFormatter = _HeaderFormatter;
|
||||
var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
||||
var _Int64 = class _Int64 {
|
||||
constructor(bytes) {
|
||||
this.bytes = bytes;
|
||||
if (bytes.byteLength !== 8) {
|
||||
throw new Error("Int64 buffers must be exactly 8 bytes");
|
||||
}
|
||||
}
|
||||
static fromNumber(number) {
|
||||
if (number > 9223372036854776e3 || number < -9223372036854776e3) {
|
||||
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
||||
}
|
||||
const bytes = new Uint8Array(8);
|
||||
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
||||
bytes[i] = remaining;
|
||||
}
|
||||
if (number < 0) {
|
||||
negate(bytes);
|
||||
}
|
||||
return new _Int64(bytes);
|
||||
}
|
||||
/**
|
||||
* Called implicitly by infix arithmetic operators.
|
||||
*/
|
||||
valueOf() {
|
||||
const bytes = this.bytes.slice(0);
|
||||
const negative = bytes[0] & 128;
|
||||
if (negative) {
|
||||
negate(bytes);
|
||||
}
|
||||
return parseInt((0, import_util_hex_encoding.toHex)(bytes), 16) * (negative ? -1 : 1);
|
||||
}
|
||||
toString() {
|
||||
return String(this.valueOf());
|
||||
}
|
||||
};
|
||||
__name(_Int64, "Int64");
|
||||
var Int64 = _Int64;
|
||||
function negate(bytes) {
|
||||
for (let i = 0; i < 8; i++) {
|
||||
bytes[i] ^= 255;
|
||||
}
|
||||
for (let i = 7; i > -1; i--) {
|
||||
bytes[i]++;
|
||||
if (bytes[i] !== 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
__name(negate, "negate");
|
||||
|
||||
// src/headerUtil.ts
|
||||
var hasHeader = /* @__PURE__ */ __name((soughtHeader, headers) => {
|
||||
soughtHeader = soughtHeader.toLowerCase();
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
if (soughtHeader === headerName.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}, "hasHeader");
|
||||
|
||||
// src/cloneRequest.ts
|
||||
var cloneRequest = /* @__PURE__ */ __name(({ headers, query, ...rest }) => ({
|
||||
...rest,
|
||||
headers: { ...headers },
|
||||
query: query ? cloneQuery(query) : void 0
|
||||
}), "cloneRequest");
|
||||
var cloneQuery = /* @__PURE__ */ __name((query) => Object.keys(query).reduce((carry, paramName) => {
|
||||
const param = query[paramName];
|
||||
return {
|
||||
...carry,
|
||||
[paramName]: Array.isArray(param) ? [...param] : param
|
||||
};
|
||||
}, {}), "cloneQuery");
|
||||
|
||||
// src/moveHeadersToQuery.ts
|
||||
var moveHeadersToQuery = /* @__PURE__ */ __name((request, options = {}) => {
|
||||
var _a;
|
||||
const { headers, query = {} } = typeof request.clone === "function" ? request.clone() : cloneRequest(request);
|
||||
for (const name of Object.keys(headers)) {
|
||||
const lname = name.toLowerCase();
|
||||
if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname))) {
|
||||
query[name] = headers[name];
|
||||
delete headers[name];
|
||||
}
|
||||
}
|
||||
return {
|
||||
...request,
|
||||
headers,
|
||||
query
|
||||
};
|
||||
}, "moveHeadersToQuery");
|
||||
|
||||
// src/prepareRequest.ts
|
||||
var prepareRequest = /* @__PURE__ */ __name((request) => {
|
||||
request = typeof request.clone === "function" ? request.clone() : cloneRequest(request);
|
||||
for (const headerName of Object.keys(request.headers)) {
|
||||
if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
|
||||
delete request.headers[headerName];
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}, "prepareRequest");
|
||||
|
||||
// src/utilDate.ts
|
||||
var iso8601 = /* @__PURE__ */ __name((time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z"), "iso8601");
|
||||
var toDate = /* @__PURE__ */ __name((time) => {
|
||||
if (typeof time === "number") {
|
||||
return new Date(time * 1e3);
|
||||
}
|
||||
if (typeof time === "string") {
|
||||
if (Number(time)) {
|
||||
return new Date(Number(time) * 1e3);
|
||||
}
|
||||
return new Date(time);
|
||||
}
|
||||
return time;
|
||||
}, "toDate");
|
||||
|
||||
// src/SignatureV4.ts
|
||||
var _SignatureV4 = class _SignatureV4 {
|
||||
constructor({
|
||||
applyChecksum,
|
||||
credentials,
|
||||
region,
|
||||
service,
|
||||
sha256,
|
||||
uriEscapePath = true
|
||||
}) {
|
||||
this.headerFormatter = new HeaderFormatter();
|
||||
this.service = service;
|
||||
this.sha256 = sha256;
|
||||
this.uriEscapePath = uriEscapePath;
|
||||
this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true;
|
||||
this.regionProvider = (0, import_util_middleware.normalizeProvider)(region);
|
||||
this.credentialProvider = (0, import_util_middleware.normalizeProvider)(credentials);
|
||||
}
|
||||
async presign(originalRequest, options = {}) {
|
||||
const {
|
||||
signingDate = /* @__PURE__ */ new Date(),
|
||||
expiresIn = 3600,
|
||||
unsignableHeaders,
|
||||
unhoistableHeaders,
|
||||
signableHeaders,
|
||||
signingRegion,
|
||||
signingService
|
||||
} = options;
|
||||
const credentials = await this.credentialProvider();
|
||||
this.validateResolvedCredentials(credentials);
|
||||
const region = signingRegion ?? await this.regionProvider();
|
||||
const { longDate, shortDate } = formatDate(signingDate);
|
||||
if (expiresIn > MAX_PRESIGNED_TTL) {
|
||||
return Promise.reject(
|
||||
"Signature version 4 presigned URLs must have an expiration date less than one week in the future"
|
||||
);
|
||||
}
|
||||
const scope = createScope(shortDate, region, signingService ?? this.service);
|
||||
const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders });
|
||||
if (credentials.sessionToken) {
|
||||
request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
||||
}
|
||||
request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;
|
||||
request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`;
|
||||
request.query[AMZ_DATE_QUERY_PARAM] = longDate;
|
||||
request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);
|
||||
const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
|
||||
request.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders);
|
||||
request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(
|
||||
longDate,
|
||||
scope,
|
||||
this.getSigningKey(credentials, region, shortDate, signingService),
|
||||
this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256))
|
||||
);
|
||||
return request;
|
||||
}
|
||||
async sign(toSign, options) {
|
||||
if (typeof toSign === "string") {
|
||||
return this.signString(toSign, options);
|
||||
} else if (toSign.headers && toSign.payload) {
|
||||
return this.signEvent(toSign, options);
|
||||
} else if (toSign.message) {
|
||||
return this.signMessage(toSign, options);
|
||||
} else {
|
||||
return this.signRequest(toSign, options);
|
||||
}
|
||||
}
|
||||
async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) {
|
||||
const region = signingRegion ?? await this.regionProvider();
|
||||
const { shortDate, longDate } = formatDate(signingDate);
|
||||
const scope = createScope(shortDate, region, signingService ?? this.service);
|
||||
const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);
|
||||
const hash = new this.sha256();
|
||||
hash.update(headers);
|
||||
const hashedHeaders = (0, import_util_hex_encoding.toHex)(await hash.digest());
|
||||
const stringToSign = [
|
||||
EVENT_ALGORITHM_IDENTIFIER,
|
||||
longDate,
|
||||
scope,
|
||||
priorSignature,
|
||||
hashedHeaders,
|
||||
hashedPayload
|
||||
].join("\n");
|
||||
return this.signString(stringToSign, { signingDate, signingRegion: region, signingService });
|
||||
}
|
||||
async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) {
|
||||
const promise = this.signEvent(
|
||||
{
|
||||
headers: this.headerFormatter.format(signableMessage.message.headers),
|
||||
payload: signableMessage.message.body
|
||||
},
|
||||
{
|
||||
signingDate,
|
||||
signingRegion,
|
||||
signingService,
|
||||
priorSignature: signableMessage.priorSignature
|
||||
}
|
||||
);
|
||||
return promise.then((signature) => {
|
||||
return { message: signableMessage.message, signature };
|
||||
});
|
||||
}
|
||||
async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) {
|
||||
const credentials = await this.credentialProvider();
|
||||
this.validateResolvedCredentials(credentials);
|
||||
const region = signingRegion ?? await this.regionProvider();
|
||||
const { shortDate } = formatDate(signingDate);
|
||||
const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));
|
||||
hash.update((0, import_util_utf84.toUint8Array)(stringToSign));
|
||||
return (0, import_util_hex_encoding.toHex)(await hash.digest());
|
||||
}
|
||||
async signRequest(requestToSign, {
|
||||
signingDate = /* @__PURE__ */ new Date(),
|
||||
signableHeaders,
|
||||
unsignableHeaders,
|
||||
signingRegion,
|
||||
signingService
|
||||
} = {}) {
|
||||
const credentials = await this.credentialProvider();
|
||||
this.validateResolvedCredentials(credentials);
|
||||
const region = signingRegion ?? await this.regionProvider();
|
||||
const request = prepareRequest(requestToSign);
|
||||
const { longDate, shortDate } = formatDate(signingDate);
|
||||
const scope = createScope(shortDate, region, signingService ?? this.service);
|
||||
request.headers[AMZ_DATE_HEADER] = longDate;
|
||||
if (credentials.sessionToken) {
|
||||
request.headers[TOKEN_HEADER] = credentials.sessionToken;
|
||||
}
|
||||
const payloadHash = await getPayloadHash(request, this.sha256);
|
||||
if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {
|
||||
request.headers[SHA256_HEADER] = payloadHash;
|
||||
}
|
||||
const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
|
||||
const signature = await this.getSignature(
|
||||
longDate,
|
||||
scope,
|
||||
this.getSigningKey(credentials, region, shortDate, signingService),
|
||||
this.createCanonicalRequest(request, canonicalHeaders, payloadHash)
|
||||
);
|
||||
request.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`;
|
||||
return request;
|
||||
}
|
||||
createCanonicalRequest(request, canonicalHeaders, payloadHash) {
|
||||
const sortedHeaders = Object.keys(canonicalHeaders).sort();
|
||||
return `${request.method}
|
||||
${this.getCanonicalPath(request)}
|
||||
${getCanonicalQuery(request)}
|
||||
${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")}
|
||||
|
||||
${sortedHeaders.join(";")}
|
||||
${payloadHash}`;
|
||||
}
|
||||
async createStringToSign(longDate, credentialScope, canonicalRequest) {
|
||||
const hash = new this.sha256();
|
||||
hash.update((0, import_util_utf84.toUint8Array)(canonicalRequest));
|
||||
const hashedRequest = await hash.digest();
|
||||
return `${ALGORITHM_IDENTIFIER}
|
||||
${longDate}
|
||||
${credentialScope}
|
||||
${(0, import_util_hex_encoding.toHex)(hashedRequest)}`;
|
||||
}
|
||||
getCanonicalPath({ path }) {
|
||||
if (this.uriEscapePath) {
|
||||
const normalizedPathSegments = [];
|
||||
for (const pathSegment of path.split("/")) {
|
||||
if ((pathSegment == null ? void 0 : pathSegment.length) === 0)
|
||||
continue;
|
||||
if (pathSegment === ".")
|
||||
continue;
|
||||
if (pathSegment === "..") {
|
||||
normalizedPathSegments.pop();
|
||||
} else {
|
||||
normalizedPathSegments.push(pathSegment);
|
||||
}
|
||||
}
|
||||
const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`;
|
||||
const doubleEncoded = (0, import_util_uri_escape.escapeUri)(normalizedPath);
|
||||
return doubleEncoded.replace(/%2F/g, "/");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
|
||||
const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest);
|
||||
const hash = new this.sha256(await keyPromise);
|
||||
hash.update((0, import_util_utf84.toUint8Array)(stringToSign));
|
||||
return (0, import_util_hex_encoding.toHex)(await hash.digest());
|
||||
}
|
||||
getSigningKey(credentials, region, shortDate, service) {
|
||||
return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
|
||||
}
|
||||
validateResolvedCredentials(credentials) {
|
||||
if (typeof credentials !== "object" || // @ts-expect-error: Property 'accessKeyId' does not exist on type 'object'.ts(2339)
|
||||
typeof credentials.accessKeyId !== "string" || // @ts-expect-error: Property 'secretAccessKey' does not exist on type 'object'.ts(2339)
|
||||
typeof credentials.secretAccessKey !== "string") {
|
||||
throw new Error("Resolved credential object is not valid");
|
||||
}
|
||||
}
|
||||
};
|
||||
__name(_SignatureV4, "SignatureV4");
|
||||
var SignatureV4 = _SignatureV4;
|
||||
var formatDate = /* @__PURE__ */ __name((now) => {
|
||||
const longDate = iso8601(now).replace(/[\-:]/g, "");
|
||||
return {
|
||||
longDate,
|
||||
shortDate: longDate.slice(0, 8)
|
||||
};
|
||||
}, "formatDate");
|
||||
var getCanonicalHeaderList = /* @__PURE__ */ __name((headers) => Object.keys(headers).sort().join(";"), "getCanonicalHeaderList");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
|
||||
0 && (module.exports = {
|
||||
getCanonicalHeaders,
|
||||
getCanonicalQuery,
|
||||
getPayloadHash,
|
||||
moveHeadersToQuery,
|
||||
prepareRequest,
|
||||
SignatureV4,
|
||||
createScope,
|
||||
getSigningKey,
|
||||
clearCredentialCache
|
||||
});
|
||||
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/moveHeadersToQuery.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/moveHeadersToQuery.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/prepareRequest.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/prepareRequest.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/suite.fixture.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/suite.fixture.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/utilDate.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/signature-v4/dist-cjs/utilDate.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
125
resources/app/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js
generated
vendored
Normal file
125
resources/app/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
import { fromHex, toHex } from "@smithy/util-hex-encoding";
|
||||
import { fromUtf8 } from "@smithy/util-utf8";
|
||||
export class HeaderFormatter {
|
||||
format(headers) {
|
||||
const chunks = [];
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
const bytes = fromUtf8(headerName);
|
||||
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
||||
}
|
||||
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
||||
let position = 0;
|
||||
for (const chunk of chunks) {
|
||||
out.set(chunk, position);
|
||||
position += chunk.byteLength;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
formatHeaderValue(header) {
|
||||
switch (header.type) {
|
||||
case "boolean":
|
||||
return Uint8Array.from([header.value ? 0 : 1]);
|
||||
case "byte":
|
||||
return Uint8Array.from([2, header.value]);
|
||||
case "short":
|
||||
const shortView = new DataView(new ArrayBuffer(3));
|
||||
shortView.setUint8(0, 3);
|
||||
shortView.setInt16(1, header.value, false);
|
||||
return new Uint8Array(shortView.buffer);
|
||||
case "integer":
|
||||
const intView = new DataView(new ArrayBuffer(5));
|
||||
intView.setUint8(0, 4);
|
||||
intView.setInt32(1, header.value, false);
|
||||
return new Uint8Array(intView.buffer);
|
||||
case "long":
|
||||
const longBytes = new Uint8Array(9);
|
||||
longBytes[0] = 5;
|
||||
longBytes.set(header.value.bytes, 1);
|
||||
return longBytes;
|
||||
case "binary":
|
||||
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
||||
binView.setUint8(0, 6);
|
||||
binView.setUint16(1, header.value.byteLength, false);
|
||||
const binBytes = new Uint8Array(binView.buffer);
|
||||
binBytes.set(header.value, 3);
|
||||
return binBytes;
|
||||
case "string":
|
||||
const utf8Bytes = fromUtf8(header.value);
|
||||
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
||||
strView.setUint8(0, 7);
|
||||
strView.setUint16(1, utf8Bytes.byteLength, false);
|
||||
const strBytes = new Uint8Array(strView.buffer);
|
||||
strBytes.set(utf8Bytes, 3);
|
||||
return strBytes;
|
||||
case "timestamp":
|
||||
const tsBytes = new Uint8Array(9);
|
||||
tsBytes[0] = 8;
|
||||
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
||||
return tsBytes;
|
||||
case "uuid":
|
||||
if (!UUID_PATTERN.test(header.value)) {
|
||||
throw new Error(`Invalid UUID received: ${header.value}`);
|
||||
}
|
||||
const uuidBytes = new Uint8Array(17);
|
||||
uuidBytes[0] = 9;
|
||||
uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
|
||||
return uuidBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
var HEADER_VALUE_TYPE;
|
||||
(function (HEADER_VALUE_TYPE) {
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolTrue"] = 0] = "boolTrue";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["boolFalse"] = 1] = "boolFalse";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byte"] = 2] = "byte";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["short"] = 3] = "short";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["integer"] = 4] = "integer";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["long"] = 5] = "long";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["byteArray"] = 6] = "byteArray";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["string"] = 7] = "string";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["timestamp"] = 8] = "timestamp";
|
||||
HEADER_VALUE_TYPE[HEADER_VALUE_TYPE["uuid"] = 9] = "uuid";
|
||||
})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
|
||||
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
||||
export class Int64 {
|
||||
constructor(bytes) {
|
||||
this.bytes = bytes;
|
||||
if (bytes.byteLength !== 8) {
|
||||
throw new Error("Int64 buffers must be exactly 8 bytes");
|
||||
}
|
||||
}
|
||||
static fromNumber(number) {
|
||||
if (number > 9223372036854776000 || number < -9223372036854776000) {
|
||||
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
||||
}
|
||||
const bytes = new Uint8Array(8);
|
||||
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
||||
bytes[i] = remaining;
|
||||
}
|
||||
if (number < 0) {
|
||||
negate(bytes);
|
||||
}
|
||||
return new Int64(bytes);
|
||||
}
|
||||
valueOf() {
|
||||
const bytes = this.bytes.slice(0);
|
||||
const negative = bytes[0] & 0b10000000;
|
||||
if (negative) {
|
||||
negate(bytes);
|
||||
}
|
||||
return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
|
||||
}
|
||||
toString() {
|
||||
return String(this.valueOf());
|
||||
}
|
||||
}
|
||||
function negate(bytes) {
|
||||
for (let i = 0; i < 8; i++) {
|
||||
bytes[i] ^= 0xff;
|
||||
}
|
||||
for (let i = 7; i > -1; i--) {
|
||||
bytes[i]++;
|
||||
if (bytes[i] !== 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
191
resources/app/node_modules/@smithy/signature-v4/dist-es/SignatureV4.js
generated
vendored
Normal file
191
resources/app/node_modules/@smithy/signature-v4/dist-es/SignatureV4.js
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
import { toHex } from "@smithy/util-hex-encoding";
|
||||
import { normalizeProvider } from "@smithy/util-middleware";
|
||||
import { escapeUri } from "@smithy/util-uri-escape";
|
||||
import { toUint8Array } from "@smithy/util-utf8";
|
||||
import { ALGORITHM_IDENTIFIER, ALGORITHM_QUERY_PARAM, AMZ_DATE_HEADER, AMZ_DATE_QUERY_PARAM, AUTH_HEADER, CREDENTIAL_QUERY_PARAM, EVENT_ALGORITHM_IDENTIFIER, EXPIRES_QUERY_PARAM, MAX_PRESIGNED_TTL, SHA256_HEADER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_HEADER, TOKEN_QUERY_PARAM, } from "./constants";
|
||||
import { createScope, getSigningKey } from "./credentialDerivation";
|
||||
import { getCanonicalHeaders } from "./getCanonicalHeaders";
|
||||
import { getCanonicalQuery } from "./getCanonicalQuery";
|
||||
import { getPayloadHash } from "./getPayloadHash";
|
||||
import { HeaderFormatter } from "./HeaderFormatter";
|
||||
import { hasHeader } from "./headerUtil";
|
||||
import { moveHeadersToQuery } from "./moveHeadersToQuery";
|
||||
import { prepareRequest } from "./prepareRequest";
|
||||
import { iso8601 } from "./utilDate";
|
||||
export class SignatureV4 {
|
||||
constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true, }) {
|
||||
this.headerFormatter = new HeaderFormatter();
|
||||
this.service = service;
|
||||
this.sha256 = sha256;
|
||||
this.uriEscapePath = uriEscapePath;
|
||||
this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true;
|
||||
this.regionProvider = normalizeProvider(region);
|
||||
this.credentialProvider = normalizeProvider(credentials);
|
||||
}
|
||||
async presign(originalRequest, options = {}) {
|
||||
const { signingDate = new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, signingRegion, signingService, } = options;
|
||||
const credentials = await this.credentialProvider();
|
||||
this.validateResolvedCredentials(credentials);
|
||||
const region = signingRegion ?? (await this.regionProvider());
|
||||
const { longDate, shortDate } = formatDate(signingDate);
|
||||
if (expiresIn > MAX_PRESIGNED_TTL) {
|
||||
return Promise.reject("Signature version 4 presigned URLs" + " must have an expiration date less than one week in" + " the future");
|
||||
}
|
||||
const scope = createScope(shortDate, region, signingService ?? this.service);
|
||||
const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders });
|
||||
if (credentials.sessionToken) {
|
||||
request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
||||
}
|
||||
request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;
|
||||
request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`;
|
||||
request.query[AMZ_DATE_QUERY_PARAM] = longDate;
|
||||
request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);
|
||||
const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
|
||||
request.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders);
|
||||
request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)));
|
||||
return request;
|
||||
}
|
||||
async sign(toSign, options) {
|
||||
if (typeof toSign === "string") {
|
||||
return this.signString(toSign, options);
|
||||
}
|
||||
else if (toSign.headers && toSign.payload) {
|
||||
return this.signEvent(toSign, options);
|
||||
}
|
||||
else if (toSign.message) {
|
||||
return this.signMessage(toSign, options);
|
||||
}
|
||||
else {
|
||||
return this.signRequest(toSign, options);
|
||||
}
|
||||
}
|
||||
async signEvent({ headers, payload }, { signingDate = new Date(), priorSignature, signingRegion, signingService }) {
|
||||
const region = signingRegion ?? (await this.regionProvider());
|
||||
const { shortDate, longDate } = formatDate(signingDate);
|
||||
const scope = createScope(shortDate, region, signingService ?? this.service);
|
||||
const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);
|
||||
const hash = new this.sha256();
|
||||
hash.update(headers);
|
||||
const hashedHeaders = toHex(await hash.digest());
|
||||
const stringToSign = [
|
||||
EVENT_ALGORITHM_IDENTIFIER,
|
||||
longDate,
|
||||
scope,
|
||||
priorSignature,
|
||||
hashedHeaders,
|
||||
hashedPayload,
|
||||
].join("\n");
|
||||
return this.signString(stringToSign, { signingDate, signingRegion: region, signingService });
|
||||
}
|
||||
async signMessage(signableMessage, { signingDate = new Date(), signingRegion, signingService }) {
|
||||
const promise = this.signEvent({
|
||||
headers: this.headerFormatter.format(signableMessage.message.headers),
|
||||
payload: signableMessage.message.body,
|
||||
}, {
|
||||
signingDate,
|
||||
signingRegion,
|
||||
signingService,
|
||||
priorSignature: signableMessage.priorSignature,
|
||||
});
|
||||
return promise.then((signature) => {
|
||||
return { message: signableMessage.message, signature };
|
||||
});
|
||||
}
|
||||
async signString(stringToSign, { signingDate = new Date(), signingRegion, signingService } = {}) {
|
||||
const credentials = await this.credentialProvider();
|
||||
this.validateResolvedCredentials(credentials);
|
||||
const region = signingRegion ?? (await this.regionProvider());
|
||||
const { shortDate } = formatDate(signingDate);
|
||||
const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));
|
||||
hash.update(toUint8Array(stringToSign));
|
||||
return toHex(await hash.digest());
|
||||
}
|
||||
async signRequest(requestToSign, { signingDate = new Date(), signableHeaders, unsignableHeaders, signingRegion, signingService, } = {}) {
|
||||
const credentials = await this.credentialProvider();
|
||||
this.validateResolvedCredentials(credentials);
|
||||
const region = signingRegion ?? (await this.regionProvider());
|
||||
const request = prepareRequest(requestToSign);
|
||||
const { longDate, shortDate } = formatDate(signingDate);
|
||||
const scope = createScope(shortDate, region, signingService ?? this.service);
|
||||
request.headers[AMZ_DATE_HEADER] = longDate;
|
||||
if (credentials.sessionToken) {
|
||||
request.headers[TOKEN_HEADER] = credentials.sessionToken;
|
||||
}
|
||||
const payloadHash = await getPayloadHash(request, this.sha256);
|
||||
if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {
|
||||
request.headers[SHA256_HEADER] = payloadHash;
|
||||
}
|
||||
const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
|
||||
const signature = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash));
|
||||
request.headers[AUTH_HEADER] =
|
||||
`${ALGORITHM_IDENTIFIER} ` +
|
||||
`Credential=${credentials.accessKeyId}/${scope}, ` +
|
||||
`SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, ` +
|
||||
`Signature=${signature}`;
|
||||
return request;
|
||||
}
|
||||
createCanonicalRequest(request, canonicalHeaders, payloadHash) {
|
||||
const sortedHeaders = Object.keys(canonicalHeaders).sort();
|
||||
return `${request.method}
|
||||
${this.getCanonicalPath(request)}
|
||||
${getCanonicalQuery(request)}
|
||||
${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")}
|
||||
|
||||
${sortedHeaders.join(";")}
|
||||
${payloadHash}`;
|
||||
}
|
||||
async createStringToSign(longDate, credentialScope, canonicalRequest) {
|
||||
const hash = new this.sha256();
|
||||
hash.update(toUint8Array(canonicalRequest));
|
||||
const hashedRequest = await hash.digest();
|
||||
return `${ALGORITHM_IDENTIFIER}
|
||||
${longDate}
|
||||
${credentialScope}
|
||||
${toHex(hashedRequest)}`;
|
||||
}
|
||||
getCanonicalPath({ path }) {
|
||||
if (this.uriEscapePath) {
|
||||
const normalizedPathSegments = [];
|
||||
for (const pathSegment of path.split("/")) {
|
||||
if (pathSegment?.length === 0)
|
||||
continue;
|
||||
if (pathSegment === ".")
|
||||
continue;
|
||||
if (pathSegment === "..") {
|
||||
normalizedPathSegments.pop();
|
||||
}
|
||||
else {
|
||||
normalizedPathSegments.push(pathSegment);
|
||||
}
|
||||
}
|
||||
const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
|
||||
const doubleEncoded = escapeUri(normalizedPath);
|
||||
return doubleEncoded.replace(/%2F/g, "/");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
|
||||
const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest);
|
||||
const hash = new this.sha256(await keyPromise);
|
||||
hash.update(toUint8Array(stringToSign));
|
||||
return toHex(await hash.digest());
|
||||
}
|
||||
getSigningKey(credentials, region, shortDate, service) {
|
||||
return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
|
||||
}
|
||||
validateResolvedCredentials(credentials) {
|
||||
if (typeof credentials !== "object" ||
|
||||
typeof credentials.accessKeyId !== "string" ||
|
||||
typeof credentials.secretAccessKey !== "string") {
|
||||
throw new Error("Resolved credential object is not valid");
|
||||
}
|
||||
}
|
||||
}
|
||||
const formatDate = (now) => {
|
||||
const longDate = iso8601(now).replace(/[\-:]/g, "");
|
||||
return {
|
||||
longDate,
|
||||
shortDate: longDate.slice(0, 8),
|
||||
};
|
||||
};
|
||||
const getCanonicalHeaderList = (headers) => Object.keys(headers).sort().join(";");
|
||||
12
resources/app/node_modules/@smithy/signature-v4/dist-es/cloneRequest.js
generated
vendored
Normal file
12
resources/app/node_modules/@smithy/signature-v4/dist-es/cloneRequest.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export const cloneRequest = ({ headers, query, ...rest }) => ({
|
||||
...rest,
|
||||
headers: { ...headers },
|
||||
query: query ? cloneQuery(query) : undefined,
|
||||
});
|
||||
export const cloneQuery = (query) => Object.keys(query).reduce((carry, paramName) => {
|
||||
const param = query[paramName];
|
||||
return {
|
||||
...carry,
|
||||
[paramName]: Array.isArray(param) ? [...param] : param,
|
||||
};
|
||||
}, {});
|
||||
43
resources/app/node_modules/@smithy/signature-v4/dist-es/constants.js
generated
vendored
Normal file
43
resources/app/node_modules/@smithy/signature-v4/dist-es/constants.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
export const ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
||||
export const CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
||||
export const AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
|
||||
export const SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
|
||||
export const EXPIRES_QUERY_PARAM = "X-Amz-Expires";
|
||||
export const SIGNATURE_QUERY_PARAM = "X-Amz-Signature";
|
||||
export const TOKEN_QUERY_PARAM = "X-Amz-Security-Token";
|
||||
export const REGION_SET_PARAM = "X-Amz-Region-Set";
|
||||
export const AUTH_HEADER = "authorization";
|
||||
export const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();
|
||||
export const DATE_HEADER = "date";
|
||||
export const GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];
|
||||
export const SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();
|
||||
export const SHA256_HEADER = "x-amz-content-sha256";
|
||||
export const TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();
|
||||
export const HOST_HEADER = "host";
|
||||
export const ALWAYS_UNSIGNABLE_HEADERS = {
|
||||
authorization: true,
|
||||
"cache-control": true,
|
||||
connection: true,
|
||||
expect: true,
|
||||
from: true,
|
||||
"keep-alive": true,
|
||||
"max-forwards": true,
|
||||
pragma: true,
|
||||
referer: true,
|
||||
te: true,
|
||||
trailer: true,
|
||||
"transfer-encoding": true,
|
||||
upgrade: true,
|
||||
"user-agent": true,
|
||||
"x-amzn-trace-id": true,
|
||||
};
|
||||
export const PROXY_HEADER_PATTERN = /^proxy-/;
|
||||
export const SEC_HEADER_PATTERN = /^sec-/;
|
||||
export const UNSIGNABLE_PATTERNS = [/^proxy-/i, /^sec-/i];
|
||||
export const ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
|
||||
export const ALGORITHM_IDENTIFIER_V4A = "AWS4-ECDSA-P256-SHA256";
|
||||
export const EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD";
|
||||
export const UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
|
||||
export const MAX_CACHE_SIZE = 50;
|
||||
export const KEY_TYPE_IDENTIFIER = "aws4_request";
|
||||
export const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
|
||||
33
resources/app/node_modules/@smithy/signature-v4/dist-es/credentialDerivation.js
generated
vendored
Normal file
33
resources/app/node_modules/@smithy/signature-v4/dist-es/credentialDerivation.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { toHex } from "@smithy/util-hex-encoding";
|
||||
import { toUint8Array } from "@smithy/util-utf8";
|
||||
import { KEY_TYPE_IDENTIFIER, MAX_CACHE_SIZE } from "./constants";
|
||||
const signingKeyCache = {};
|
||||
const cacheQueue = [];
|
||||
export const createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`;
|
||||
export const getSigningKey = async (sha256Constructor, credentials, shortDate, region, service) => {
|
||||
const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId);
|
||||
const cacheKey = `${shortDate}:${region}:${service}:${toHex(credsHash)}:${credentials.sessionToken}`;
|
||||
if (cacheKey in signingKeyCache) {
|
||||
return signingKeyCache[cacheKey];
|
||||
}
|
||||
cacheQueue.push(cacheKey);
|
||||
while (cacheQueue.length > MAX_CACHE_SIZE) {
|
||||
delete signingKeyCache[cacheQueue.shift()];
|
||||
}
|
||||
let key = `AWS4${credentials.secretAccessKey}`;
|
||||
for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) {
|
||||
key = await hmac(sha256Constructor, key, signable);
|
||||
}
|
||||
return (signingKeyCache[cacheKey] = key);
|
||||
};
|
||||
export const clearCredentialCache = () => {
|
||||
cacheQueue.length = 0;
|
||||
Object.keys(signingKeyCache).forEach((cacheKey) => {
|
||||
delete signingKeyCache[cacheKey];
|
||||
});
|
||||
};
|
||||
const hmac = (ctor, secret, data) => {
|
||||
const hash = new ctor(secret);
|
||||
hash.update(toUint8Array(data));
|
||||
return hash.digest();
|
||||
};
|
||||
20
resources/app/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js
generated
vendored
Normal file
20
resources/app/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ALWAYS_UNSIGNABLE_HEADERS, PROXY_HEADER_PATTERN, SEC_HEADER_PATTERN } from "./constants";
|
||||
export const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
|
||||
const canonical = {};
|
||||
for (const headerName of Object.keys(headers).sort()) {
|
||||
if (headers[headerName] == undefined) {
|
||||
continue;
|
||||
}
|
||||
const canonicalHeaderName = headerName.toLowerCase();
|
||||
if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS ||
|
||||
unsignableHeaders?.has(canonicalHeaderName) ||
|
||||
PROXY_HEADER_PATTERN.test(canonicalHeaderName) ||
|
||||
SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
|
||||
if (!signableHeaders || (signableHeaders && !signableHeaders.has(canonicalHeaderName))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " ");
|
||||
}
|
||||
return canonical;
|
||||
};
|
||||
27
resources/app/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
generated
vendored
Normal file
27
resources/app/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { escapeUri } from "@smithy/util-uri-escape";
|
||||
import { SIGNATURE_HEADER } from "./constants";
|
||||
export const getCanonicalQuery = ({ query = {} }) => {
|
||||
const keys = [];
|
||||
const serialized = {};
|
||||
for (const key of Object.keys(query).sort()) {
|
||||
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
||||
continue;
|
||||
}
|
||||
keys.push(key);
|
||||
const value = query[key];
|
||||
if (typeof value === "string") {
|
||||
serialized[key] = `${escapeUri(key)}=${escapeUri(value)}`;
|
||||
}
|
||||
else if (Array.isArray(value)) {
|
||||
serialized[key] = value
|
||||
.slice(0)
|
||||
.reduce((encoded, value) => encoded.concat([`${escapeUri(key)}=${escapeUri(value)}`]), [])
|
||||
.sort()
|
||||
.join("&");
|
||||
}
|
||||
}
|
||||
return keys
|
||||
.map((key) => serialized[key])
|
||||
.filter((serialized) => serialized)
|
||||
.join("&");
|
||||
};
|
||||
20
resources/app/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js
generated
vendored
Normal file
20
resources/app/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { isArrayBuffer } from "@smithy/is-array-buffer";
|
||||
import { toHex } from "@smithy/util-hex-encoding";
|
||||
import { toUint8Array } from "@smithy/util-utf8";
|
||||
import { SHA256_HEADER, UNSIGNED_PAYLOAD } from "./constants";
|
||||
export const getPayloadHash = async ({ headers, body }, hashConstructor) => {
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
if (headerName.toLowerCase() === SHA256_HEADER) {
|
||||
return headers[headerName];
|
||||
}
|
||||
}
|
||||
if (body == undefined) {
|
||||
return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
|
||||
}
|
||||
else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) {
|
||||
const hashCtor = new hashConstructor();
|
||||
hashCtor.update(toUint8Array(body));
|
||||
return toHex(await hashCtor.digest());
|
||||
}
|
||||
return UNSIGNED_PAYLOAD;
|
||||
};
|
||||
26
resources/app/node_modules/@smithy/signature-v4/dist-es/headerUtil.js
generated
vendored
Normal file
26
resources/app/node_modules/@smithy/signature-v4/dist-es/headerUtil.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export const hasHeader = (soughtHeader, headers) => {
|
||||
soughtHeader = soughtHeader.toLowerCase();
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
if (soughtHeader === headerName.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export const getHeaderValue = (soughtHeader, headers) => {
|
||||
soughtHeader = soughtHeader.toLowerCase();
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
if (soughtHeader === headerName.toLowerCase()) {
|
||||
return headers[headerName];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
export const deleteHeader = (soughtHeader, headers) => {
|
||||
soughtHeader = soughtHeader.toLowerCase();
|
||||
for (const headerName of Object.keys(headers)) {
|
||||
if (soughtHeader === headerName.toLowerCase()) {
|
||||
delete headers[headerName];
|
||||
}
|
||||
}
|
||||
};
|
||||
7
resources/app/node_modules/@smithy/signature-v4/dist-es/index.js
generated
vendored
Normal file
7
resources/app/node_modules/@smithy/signature-v4/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from "./SignatureV4";
|
||||
export { getCanonicalHeaders } from "./getCanonicalHeaders";
|
||||
export { getCanonicalQuery } from "./getCanonicalQuery";
|
||||
export { getPayloadHash } from "./getPayloadHash";
|
||||
export { moveHeadersToQuery } from "./moveHeadersToQuery";
|
||||
export { prepareRequest } from "./prepareRequest";
|
||||
export * from "./credentialDerivation";
|
||||
16
resources/app/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
generated
vendored
Normal file
16
resources/app/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { cloneRequest } from "./cloneRequest";
|
||||
export const moveHeadersToQuery = (request, options = {}) => {
|
||||
const { headers, query = {} } = typeof request.clone === "function" ? request.clone() : cloneRequest(request);
|
||||
for (const name of Object.keys(headers)) {
|
||||
const lname = name.toLowerCase();
|
||||
if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname)) {
|
||||
query[name] = headers[name];
|
||||
delete headers[name];
|
||||
}
|
||||
}
|
||||
return {
|
||||
...request,
|
||||
headers,
|
||||
query,
|
||||
};
|
||||
};
|
||||
11
resources/app/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js
generated
vendored
Normal file
11
resources/app/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { cloneRequest } from "./cloneRequest";
|
||||
import { GENERATED_HEADERS } from "./constants";
|
||||
export const prepareRequest = (request) => {
|
||||
request = typeof request.clone === "function" ? request.clone() : cloneRequest(request);
|
||||
for (const headerName of Object.keys(request.headers)) {
|
||||
if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
|
||||
delete request.headers[headerName];
|
||||
}
|
||||
}
|
||||
return request;
|
||||
};
|
||||
399
resources/app/node_modules/@smithy/signature-v4/dist-es/suite.fixture.js
generated
vendored
Normal file
399
resources/app/node_modules/@smithy/signature-v4/dist-es/suite.fixture.js
generated
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
export const region = "us-east-1";
|
||||
export const service = "service";
|
||||
export const credentials = {
|
||||
accessKeyId: "AKIDEXAMPLE",
|
||||
secretAccessKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
|
||||
};
|
||||
export const signingDate = new Date("2015-08-30T12:36:00Z");
|
||||
export const requests = [
|
||||
{
|
||||
name: "get-header-key-duplicate",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"my-header1": "value2,value2,value1",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;my-header1;x-amz-date, Signature=c9d5ea9f3f72853aea855b47ea873832890dbdd183b4468f858259531a5138ea",
|
||||
},
|
||||
{
|
||||
name: "get-header-value-multiline",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"my-header1": "value1,value2,value3",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;my-header1;x-amz-date, Signature=ba17b383a53190154eb5fa66a1b836cc297cc0a3d70a5d00705980573d8ff790",
|
||||
},
|
||||
{
|
||||
name: "get-header-value-order",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"my-header1": "value4,value1,value3,value2",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;my-header1;x-amz-date, Signature=08c7e5a9acfcfeb3ab6b2185e75ce8b1deb5e634ec47601a50643f830c755c01",
|
||||
},
|
||||
{
|
||||
name: "get-header-value-trim",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"my-header1": "value1",
|
||||
"my-header2": '"a b c"',
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;my-header1;my-header2;x-amz-date, Signature=acc3ed3afb60bb290fc8d2dd0098b9911fcaa05412b367055dee359757a9c736",
|
||||
},
|
||||
{
|
||||
name: "get-unreserved",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=07ef7494c76fa4850883e2b006601f940f8a34d404d0cfa977f52a65bbf5f24f",
|
||||
},
|
||||
{
|
||||
name: "get-utf8",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/ሴ",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=8318018e0b0f223aa2bbf98705b62bb787dc9c0e678f255a891fd03141be5d85",
|
||||
},
|
||||
{
|
||||
name: "get-vanilla",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31",
|
||||
},
|
||||
{
|
||||
name: "get-vanilla-empty-query-key",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
Param1: "value1",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=a67d582fa61cc504c4bae71f336f98b97f1ea3c7a6bfe1b6e45aec72011b9aeb",
|
||||
},
|
||||
{
|
||||
name: "get-vanilla-query",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31",
|
||||
},
|
||||
{
|
||||
name: "get-vanilla-query-order-key-case",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
Param2: "value2",
|
||||
Param1: "value1",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=b97d918cfa904a5beff61c982a1b6f458b799221646efd99d3219ec94cdf2500",
|
||||
},
|
||||
{
|
||||
name: "get-vanilla-query-unreserved",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
"-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": "-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=9c3e54bfcdf0b19771a7f523ee5669cdf59bc7cc0884027167c21bb143a40197",
|
||||
},
|
||||
{
|
||||
name: "get-vanilla-utf8-query",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "GET",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
ሴ: "bar",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=2cdec8eed098649ff3a119c94853b13c643bcf08f8b0a1d91e12c9027818dd04",
|
||||
},
|
||||
{
|
||||
name: "post-header-key-case",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5da7c1a2acd57cee7505fc6676e4e544621c30862966e37dddb68e92efbe5d6b",
|
||||
},
|
||||
{
|
||||
name: "post-header-key-sort",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"my-header1": "value1",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;my-header1;x-amz-date, Signature=c5410059b04c1ee005303aed430f6e6645f61f4dc9e1461ec8f8916fdf18852c",
|
||||
},
|
||||
{
|
||||
name: "post-header-value-case",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"my-header1": "VALUE1",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;my-header1;x-amz-date, Signature=cdbc9802e29d2942e5e10b5bccfdd67c5f22c7c4e8ae67b53629efa58b974b7d",
|
||||
},
|
||||
{
|
||||
name: "post-sts-header-after",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5da7c1a2acd57cee7505fc6676e4e544621c30862966e37dddb68e92efbe5d6b",
|
||||
},
|
||||
{
|
||||
name: "post-sts-header-before",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
"x-amz-security-token": "AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=85d96828115b5dc0cfc3bd16ad9e210dd772bbebba041836c64533a82be05ead",
|
||||
},
|
||||
{
|
||||
name: "post-vanilla",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5da7c1a2acd57cee7505fc6676e4e544621c30862966e37dddb68e92efbe5d6b",
|
||||
},
|
||||
{
|
||||
name: "post-vanilla-empty-query-value",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
Param1: "value1",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=28038455d6de14eafc1f9222cf5aa6f1a96197d7deb8263271d420d138af7f11",
|
||||
},
|
||||
{
|
||||
name: "post-vanilla-query",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
Param1: "value1",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=28038455d6de14eafc1f9222cf5aa6f1a96197d7deb8263271d420d138af7f11",
|
||||
},
|
||||
{
|
||||
name: "post-vanilla-query-nonunreserved",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
"@#$%^": "",
|
||||
"+": '/,?><`";:\\|][{}',
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=66c82657c86e26fb25238d0e69f011edc4c6df5ae71119d7cb98ed9b87393c1e",
|
||||
},
|
||||
{
|
||||
name: "post-vanilla-query-space",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {
|
||||
p: "",
|
||||
},
|
||||
headers: {
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=e71688addb58a26418614085fb730ba3faa623b461c17f48f2fbdb9361b94a9b",
|
||||
},
|
||||
{
|
||||
name: "post-x-www-form-urlencoded",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
body: "Param1=value1",
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=ff11897932ad3f4e8b18135d722051e5ac45fc38421b1da7b9d196a0fe09473a",
|
||||
},
|
||||
{
|
||||
name: "post-x-www-form-urlencoded-parameters",
|
||||
request: {
|
||||
protocol: "https:",
|
||||
method: "POST",
|
||||
hostname: "example.amazonaws.com",
|
||||
query: {},
|
||||
headers: {
|
||||
"content-type": "application/x-www-form-urlencoded; charset=utf8",
|
||||
host: "example.amazonaws.com",
|
||||
"x-amz-date": "20150830T123600Z",
|
||||
},
|
||||
body: "Param1=value1",
|
||||
path: "/",
|
||||
},
|
||||
authorization: "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=1a72ec8f64bd914b0e42e42607c7fbce7fb2c7465f63e3092b3b0d39fa77a6fe",
|
||||
},
|
||||
];
|
||||
15
resources/app/node_modules/@smithy/signature-v4/dist-es/utilDate.js
generated
vendored
Normal file
15
resources/app/node_modules/@smithy/signature-v4/dist-es/utilDate.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export const iso8601 = (time) => toDate(time)
|
||||
.toISOString()
|
||||
.replace(/\.\d{3}Z$/, "Z");
|
||||
export const toDate = (time) => {
|
||||
if (typeof time === "number") {
|
||||
return new Date(time * 1000);
|
||||
}
|
||||
if (typeof time === "string") {
|
||||
if (Number(time)) {
|
||||
return new Date(Number(time) * 1000);
|
||||
}
|
||||
return new Date(time);
|
||||
}
|
||||
return time;
|
||||
};
|
||||
55
resources/app/node_modules/@smithy/signature-v4/package.json
generated
vendored
Normal file
55
resources/app/node_modules/@smithy/signature-v4/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "@smithy/signature-v4",
|
||||
"version": "3.0.0",
|
||||
"description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
|
||||
"main": "./dist-cjs/index.js",
|
||||
"module": "./dist-es/index.js",
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"author": {
|
||||
"name": "AWS SDK for JavaScript Team",
|
||||
"url": "https://aws.amazon.com/javascript/"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@smithy/is-array-buffer": "^3.0.0",
|
||||
"@smithy/types": "^3.0.0",
|
||||
"@smithy/util-hex-encoding": "^3.0.0",
|
||||
"@smithy/util-middleware": "^3.0.0",
|
||||
"@smithy/util-uri-escape": "^3.0.0",
|
||||
"@smithy/util-utf8": "^3.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aws-crypto/sha256-js": "3.0.0",
|
||||
"@smithy/protocol-http": "^4.0.0",
|
||||
"concurrently": "7.0.0",
|
||||
"downlevel-dts": "0.10.1",
|
||||
"rimraf": "3.0.2",
|
||||
"typedoc": "0.23.23"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"typesVersions": {
|
||||
"<4.0": {
|
||||
"dist-types/*": [
|
||||
"dist-types/ts3.4/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**"
|
||||
],
|
||||
"homepage": "https://github.com/awslabs/smithy-typescript/tree/main/packages/signature-v4",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/awslabs/smithy-typescript.git",
|
||||
"directory": "packages/signature-v4"
|
||||
},
|
||||
"typedoc": {
|
||||
"entryPoint": "src/index.ts"
|
||||
},
|
||||
"publishConfig": {
|
||||
"directory": ".release/package"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user