@smithy/signature-v4 4.1.2 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js
CHANGED
|
@@ -136,22 +136,20 @@ var import_util_uri_escape = require("@smithy/util-uri-escape");
|
|
|
136
136
|
var getCanonicalQuery = /* @__PURE__ */ __name(({ query = {} }) => {
|
|
137
137
|
const keys = [];
|
|
138
138
|
const serialized = {};
|
|
139
|
-
for (const key of Object.keys(query)
|
|
139
|
+
for (const key of Object.keys(query)) {
|
|
140
140
|
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
|
141
141
|
continue;
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
const encodedKey = (0, import_util_uri_escape.escapeUri)(key);
|
|
144
|
+
keys.push(encodedKey);
|
|
144
145
|
const value = query[key];
|
|
145
146
|
if (typeof value === "string") {
|
|
146
|
-
serialized[
|
|
147
|
+
serialized[encodedKey] = `${encodedKey}=${(0, import_util_uri_escape.escapeUri)(value)}`;
|
|
147
148
|
} else if (Array.isArray(value)) {
|
|
148
|
-
serialized[
|
|
149
|
-
(encoded, value2) => encoded.concat([`${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value2)}`]),
|
|
150
|
-
[]
|
|
151
|
-
).sort().join("&");
|
|
149
|
+
serialized[encodedKey] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${encodedKey}=${(0, import_util_uri_escape.escapeUri)(value2)}`]), []).sort().join("&");
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
|
-
return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
|
|
152
|
+
return keys.sort().map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
|
|
155
153
|
}, "getCanonicalQuery");
|
|
156
154
|
|
|
157
155
|
// src/getPayloadHash.ts
|
|
@@ -3,24 +3,26 @@ import { SIGNATURE_HEADER } from "./constants";
|
|
|
3
3
|
export const getCanonicalQuery = ({ query = {} }) => {
|
|
4
4
|
const keys = [];
|
|
5
5
|
const serialized = {};
|
|
6
|
-
for (const key of Object.keys(query)
|
|
6
|
+
for (const key of Object.keys(query)) {
|
|
7
7
|
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
|
8
8
|
continue;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
const encodedKey = escapeUri(key);
|
|
11
|
+
keys.push(encodedKey);
|
|
11
12
|
const value = query[key];
|
|
12
13
|
if (typeof value === "string") {
|
|
13
|
-
serialized[
|
|
14
|
+
serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
|
|
14
15
|
}
|
|
15
16
|
else if (Array.isArray(value)) {
|
|
16
|
-
serialized[
|
|
17
|
+
serialized[encodedKey] = value
|
|
17
18
|
.slice(0)
|
|
18
|
-
.reduce((encoded, value) => encoded.concat([`${
|
|
19
|
+
.reduce((encoded, value) => encoded.concat([`${encodedKey}=${escapeUri(value)}`]), [])
|
|
19
20
|
.sort()
|
|
20
21
|
.join("&");
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
return keys
|
|
25
|
+
.sort()
|
|
24
26
|
.map((key) => serialized[key])
|
|
25
27
|
.filter((serialized) => serialized)
|
|
26
28
|
.join("&");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/signature-v4",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@smithy/is-array-buffer": "^3.0.0",
|
|
28
|
-
"@smithy/protocol-http": "^4.1.
|
|
29
|
-
"@smithy/types": "^3.4.
|
|
28
|
+
"@smithy/protocol-http": "^4.1.3",
|
|
29
|
+
"@smithy/types": "^3.4.2",
|
|
30
30
|
"@smithy/util-hex-encoding": "^3.0.0",
|
|
31
|
-
"@smithy/util-middleware": "^3.0.
|
|
31
|
+
"@smithy/util-middleware": "^3.0.6",
|
|
32
32
|
"@smithy/util-uri-escape": "^3.0.0",
|
|
33
33
|
"@smithy/util-utf8": "^3.0.0",
|
|
34
34
|
"tslib": "^2.6.2"
|