@aws-sdk/middleware-signing 3.972.16 → 3.972.18
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 +16 -18
- package/package.json +8 -8
package/dist-cjs/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var signatureV4 = require('@smithy/signature-v4');
|
|
6
|
-
var protocols = require('@smithy/core/protocols');
|
|
1
|
+
const { normalizeProvider } = require("@smithy/core/client");
|
|
2
|
+
const { memoize } = require("@smithy/core/config");
|
|
3
|
+
const { SignatureV4 } = require("@smithy/signature-v4");
|
|
4
|
+
const { HttpRequest, HttpResponse } = require("@smithy/core/protocols");
|
|
7
5
|
|
|
8
6
|
const CREDENTIAL_EXPIRE_WINDOW = 300000;
|
|
9
7
|
const resolveAwsAuthConfig = (input) => {
|
|
@@ -11,10 +9,10 @@ const resolveAwsAuthConfig = (input) => {
|
|
|
11
9
|
const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input;
|
|
12
10
|
let signer;
|
|
13
11
|
if (input.signer) {
|
|
14
|
-
signer =
|
|
12
|
+
signer = normalizeProvider(input.signer);
|
|
15
13
|
}
|
|
16
14
|
else if (input.regionInfoProvider) {
|
|
17
|
-
signer = () =>
|
|
15
|
+
signer = () => normalizeProvider(input.region)()
|
|
18
16
|
.then(async (region) => [
|
|
19
17
|
(await input.regionInfoProvider(region, {
|
|
20
18
|
useFipsEndpoint: await input.useFipsEndpoint(),
|
|
@@ -34,7 +32,7 @@ const resolveAwsAuthConfig = (input) => {
|
|
|
34
32
|
sha256,
|
|
35
33
|
uriEscapePath: signingEscapePath,
|
|
36
34
|
};
|
|
37
|
-
const SignerCtor = input.signerConstructor ||
|
|
35
|
+
const SignerCtor = input.signerConstructor || SignatureV4;
|
|
38
36
|
return new SignerCtor(params);
|
|
39
37
|
});
|
|
40
38
|
}
|
|
@@ -43,7 +41,7 @@ const resolveAwsAuthConfig = (input) => {
|
|
|
43
41
|
authScheme = Object.assign({}, {
|
|
44
42
|
name: "sigv4",
|
|
45
43
|
signingName: input.signingName || input.defaultSigningName,
|
|
46
|
-
signingRegion: await
|
|
44
|
+
signingRegion: await normalizeProvider(input.region)(),
|
|
47
45
|
properties: {},
|
|
48
46
|
}, authScheme);
|
|
49
47
|
const isSigv4a = authScheme?.name === "sigv4a";
|
|
@@ -66,7 +64,7 @@ const resolveAwsAuthConfig = (input) => {
|
|
|
66
64
|
sha256,
|
|
67
65
|
uriEscapePath: signingEscapePath,
|
|
68
66
|
};
|
|
69
|
-
const SignerCtor = input.signerConstructor ||
|
|
67
|
+
const SignerCtor = input.signerConstructor || SignatureV4;
|
|
70
68
|
return new SignerCtor(params);
|
|
71
69
|
};
|
|
72
70
|
}
|
|
@@ -82,10 +80,10 @@ const resolveSigV4AuthConfig = (input) => {
|
|
|
82
80
|
const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input;
|
|
83
81
|
let signer;
|
|
84
82
|
if (input.signer) {
|
|
85
|
-
signer =
|
|
83
|
+
signer = normalizeProvider(input.signer);
|
|
86
84
|
}
|
|
87
85
|
else {
|
|
88
|
-
signer =
|
|
86
|
+
signer = normalizeProvider(new SignatureV4({
|
|
89
87
|
credentials: normalizedCreds,
|
|
90
88
|
region: input.region,
|
|
91
89
|
service: input.signingName,
|
|
@@ -102,10 +100,10 @@ const resolveSigV4AuthConfig = (input) => {
|
|
|
102
100
|
};
|
|
103
101
|
const normalizeCredentialProvider = (credentials) => {
|
|
104
102
|
if (typeof credentials === "function") {
|
|
105
|
-
return
|
|
103
|
+
return memoize(credentials, (credentials) => credentials.expiration !== undefined &&
|
|
106
104
|
credentials.expiration.getTime() - Date.now() < CREDENTIAL_EXPIRE_WINDOW, (credentials) => credentials.expiration !== undefined);
|
|
107
105
|
}
|
|
108
|
-
return
|
|
106
|
+
return normalizeProvider(credentials);
|
|
109
107
|
};
|
|
110
108
|
const createConfigBoundCredentialProvider = (input) => {
|
|
111
109
|
const normalizedCredentialsProvider = input.credentials
|
|
@@ -115,7 +113,7 @@ const createConfigBoundCredentialProvider = (input) => {
|
|
|
115
113
|
}));
|
|
116
114
|
const normalizedCreds = async () => normalizedCredentialsProvider({
|
|
117
115
|
callerClientConfig: {
|
|
118
|
-
region:
|
|
116
|
+
region: normalizeProvider(input.region),
|
|
119
117
|
profile: input.profile,
|
|
120
118
|
},
|
|
121
119
|
});
|
|
@@ -135,7 +133,7 @@ const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
|
|
|
135
133
|
};
|
|
136
134
|
|
|
137
135
|
const awsAuthMiddleware = (options) => (next, context) => async function (args) {
|
|
138
|
-
if (!
|
|
136
|
+
if (!HttpRequest.isInstance(args.request))
|
|
139
137
|
return next(args);
|
|
140
138
|
let authScheme;
|
|
141
139
|
let signer;
|
|
@@ -198,7 +196,7 @@ const awsAuthMiddleware = (options) => (next, context) => async function (args)
|
|
|
198
196
|
}
|
|
199
197
|
return output;
|
|
200
198
|
};
|
|
201
|
-
const getDateHeader = (response) =>
|
|
199
|
+
const getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
|
|
202
200
|
const awsAuthMiddlewareOptions = {
|
|
203
201
|
name: "awsAuthMiddleware",
|
|
204
202
|
tags: ["SIGNATURE", "AWSAUTH"],
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-signing",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.18",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
|
-
"build:cjs": "node ../../scripts/compilation/inline
|
|
7
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
6
|
+
"build:cjs": "node ../../scripts/compilation/inline",
|
|
7
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
9
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
9
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
10
10
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
11
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
12
|
-
"test": "yarn g:vitest run",
|
|
13
|
-
"test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
|
|
11
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
14
12
|
"extract:docs": "api-extractor run --local",
|
|
13
|
+
"test": "yarn g:vitest run",
|
|
15
14
|
"test:watch": "yarn g:vitest watch",
|
|
15
|
+
"test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
|
|
16
16
|
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
|
|
17
17
|
},
|
|
18
18
|
"main": "./dist-cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aws-sdk/types": "^3.973.
|
|
28
|
+
"@aws-sdk/types": "^3.973.13",
|
|
29
29
|
"@smithy/core": "^3.24.6",
|
|
30
30
|
"@smithy/signature-v4": "^5.4.6",
|
|
31
31
|
"@smithy/types": "^4.14.3",
|