@aws-sdk/signature-v4-multi-region 3.460.0 → 3.461.0
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/SignatureV4MultiRegion.js +16 -2
- package/dist-es/SignatureV4MultiRegion.js +16 -2
- package/dist-types/SignatureV4MultiRegion.d.ts +7 -2
- package/dist-types/signature-v4-crt-container.d.ts +5 -2
- package/dist-types/ts3.4/SignatureV4MultiRegion.d.ts +12 -1
- package/dist-types/ts3.4/signature-v4-crt-container.d.ts +15 -2
- package/package.json +2 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SignatureV4MultiRegion = void 0;
|
|
4
|
-
const
|
|
4
|
+
const middleware_sdk_s3_1 = require("@aws-sdk/middleware-sdk-s3");
|
|
5
5
|
const signature_v4_crt_container_1 = require("./signature-v4-crt-container");
|
|
6
6
|
class SignatureV4MultiRegion {
|
|
7
7
|
constructor(options) {
|
|
8
|
-
this.sigv4Signer = new
|
|
8
|
+
this.sigv4Signer = new middleware_sdk_s3_1.SignatureV4S3Express(options);
|
|
9
9
|
this.signerOptions = options;
|
|
10
10
|
}
|
|
11
11
|
async sign(requestToSign, options = {}) {
|
|
@@ -16,6 +16,14 @@ class SignatureV4MultiRegion {
|
|
|
16
16
|
}
|
|
17
17
|
return this.sigv4Signer.sign(requestToSign, options);
|
|
18
18
|
}
|
|
19
|
+
async signWithCredentials(requestToSign, credentials, options = {}) {
|
|
20
|
+
if (options.signingRegion === "*") {
|
|
21
|
+
if (this.signerOptions.runtime !== "node")
|
|
22
|
+
throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");
|
|
23
|
+
return this.getSigv4aSigner().signWithCredentials(requestToSign, credentials, options);
|
|
24
|
+
}
|
|
25
|
+
return this.sigv4Signer.signWithCredentials(requestToSign, credentials, options);
|
|
26
|
+
}
|
|
19
27
|
async presign(originalRequest, options = {}) {
|
|
20
28
|
if (options.signingRegion === "*") {
|
|
21
29
|
if (this.signerOptions.runtime !== "node")
|
|
@@ -24,6 +32,12 @@ class SignatureV4MultiRegion {
|
|
|
24
32
|
}
|
|
25
33
|
return this.sigv4Signer.presign(originalRequest, options);
|
|
26
34
|
}
|
|
35
|
+
async presignWithCredentials(originalRequest, credentials, options = {}) {
|
|
36
|
+
if (options.signingRegion === "*") {
|
|
37
|
+
throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");
|
|
38
|
+
}
|
|
39
|
+
return this.sigv4Signer.presignWithCredentials(originalRequest, credentials, options);
|
|
40
|
+
}
|
|
27
41
|
getSigv4aSigner() {
|
|
28
42
|
if (!this.sigv4aSigner) {
|
|
29
43
|
let CrtSignerV4 = null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SignatureV4S3Express } from "@aws-sdk/middleware-sdk-s3";
|
|
2
2
|
import { signatureV4CrtContainer } from "./signature-v4-crt-container";
|
|
3
3
|
export class SignatureV4MultiRegion {
|
|
4
4
|
constructor(options) {
|
|
5
|
-
this.sigv4Signer = new
|
|
5
|
+
this.sigv4Signer = new SignatureV4S3Express(options);
|
|
6
6
|
this.signerOptions = options;
|
|
7
7
|
}
|
|
8
8
|
async sign(requestToSign, options = {}) {
|
|
@@ -13,6 +13,14 @@ export class SignatureV4MultiRegion {
|
|
|
13
13
|
}
|
|
14
14
|
return this.sigv4Signer.sign(requestToSign, options);
|
|
15
15
|
}
|
|
16
|
+
async signWithCredentials(requestToSign, credentials, options = {}) {
|
|
17
|
+
if (options.signingRegion === "*") {
|
|
18
|
+
if (this.signerOptions.runtime !== "node")
|
|
19
|
+
throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");
|
|
20
|
+
return this.getSigv4aSigner().signWithCredentials(requestToSign, credentials, options);
|
|
21
|
+
}
|
|
22
|
+
return this.sigv4Signer.signWithCredentials(requestToSign, credentials, options);
|
|
23
|
+
}
|
|
16
24
|
async presign(originalRequest, options = {}) {
|
|
17
25
|
if (options.signingRegion === "*") {
|
|
18
26
|
if (this.signerOptions.runtime !== "node")
|
|
@@ -21,6 +29,12 @@ export class SignatureV4MultiRegion {
|
|
|
21
29
|
}
|
|
22
30
|
return this.sigv4Signer.presign(originalRequest, options);
|
|
23
31
|
}
|
|
32
|
+
async presignWithCredentials(originalRequest, credentials, options = {}) {
|
|
33
|
+
if (options.signingRegion === "*") {
|
|
34
|
+
throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");
|
|
35
|
+
}
|
|
36
|
+
return this.sigv4Signer.presignWithCredentials(originalRequest, credentials, options);
|
|
37
|
+
}
|
|
24
38
|
getSigv4aSigner() {
|
|
25
39
|
if (!this.sigv4aSigner) {
|
|
26
40
|
let CrtSignerV4 = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SignatureV4CryptoInit, SignatureV4Init } from "@smithy/signature-v4";
|
|
2
|
-
import { HttpRequest, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments } from "@smithy/types";
|
|
2
|
+
import { AwsCredentialIdentity, HttpRequest, RequestPresigner, RequestPresigningArguments, RequestSigner, RequestSigningArguments } from "@smithy/types";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -15,11 +15,16 @@ export type SignatureV4MultiRegionInit = SignatureV4Init & SignatureV4CryptoInit
|
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export declare class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {
|
|
18
|
-
private readonly sigv4Signer;
|
|
19
18
|
private sigv4aSigner?;
|
|
19
|
+
private readonly sigv4Signer;
|
|
20
20
|
private readonly signerOptions;
|
|
21
21
|
constructor(options: SignatureV4MultiRegionInit);
|
|
22
22
|
sign(requestToSign: HttpRequest, options?: RequestSigningArguments): Promise<HttpRequest>;
|
|
23
|
+
/**
|
|
24
|
+
* Sign with alternate credentials to the ones provided in the constructor.
|
|
25
|
+
*/
|
|
26
|
+
signWithCredentials(requestToSign: HttpRequest, credentials: AwsCredentialIdentity, options?: RequestSigningArguments): Promise<HttpRequest>;
|
|
23
27
|
presign(originalRequest: HttpRequest, options?: RequestPresigningArguments): Promise<HttpRequest>;
|
|
28
|
+
presignWithCredentials(originalRequest: HttpRequest, credentials: AwsCredentialIdentity, options?: RequestPresigningArguments): Promise<HttpRequest>;
|
|
24
29
|
private getSigv4aSigner;
|
|
25
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AwsCredentialIdentity } from "@aws-sdk/types";
|
|
2
|
+
import type { HttpRequest, RequestPresigner, RequestSigner, RequestSigningArguments } from "@smithy/types";
|
|
2
3
|
/**
|
|
3
4
|
* @public
|
|
4
5
|
*/
|
|
@@ -9,7 +10,9 @@ export type OptionalCrtSignerV4 = {
|
|
|
9
10
|
*
|
|
10
11
|
* The true type is CrtSignerV4 from \@aws-sdk/signature-v4-crt.
|
|
11
12
|
*/
|
|
12
|
-
new (options: any): RequestPresigner & RequestSigner
|
|
13
|
+
new (options: any): RequestPresigner & RequestSigner & {
|
|
14
|
+
signWithCredentials(requestToSign: HttpRequest, credentials: AwsCredentialIdentity, options: RequestSigningArguments): Promise<HttpRequest>;
|
|
15
|
+
};
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
18
|
* @public
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SignatureV4CryptoInit, SignatureV4Init } from "@smithy/signature-v4";
|
|
2
2
|
import {
|
|
3
|
+
AwsCredentialIdentity,
|
|
3
4
|
HttpRequest,
|
|
4
5
|
RequestPresigner,
|
|
5
6
|
RequestPresigningArguments,
|
|
@@ -13,17 +14,27 @@ export type SignatureV4MultiRegionInit = SignatureV4Init &
|
|
|
13
14
|
export declare class SignatureV4MultiRegion
|
|
14
15
|
implements RequestPresigner, RequestSigner
|
|
15
16
|
{
|
|
16
|
-
private readonly sigv4Signer;
|
|
17
17
|
private sigv4aSigner?;
|
|
18
|
+
private readonly sigv4Signer;
|
|
18
19
|
private readonly signerOptions;
|
|
19
20
|
constructor(options: SignatureV4MultiRegionInit);
|
|
20
21
|
sign(
|
|
21
22
|
requestToSign: HttpRequest,
|
|
22
23
|
options?: RequestSigningArguments
|
|
23
24
|
): Promise<HttpRequest>;
|
|
25
|
+
signWithCredentials(
|
|
26
|
+
requestToSign: HttpRequest,
|
|
27
|
+
credentials: AwsCredentialIdentity,
|
|
28
|
+
options?: RequestSigningArguments
|
|
29
|
+
): Promise<HttpRequest>;
|
|
24
30
|
presign(
|
|
25
31
|
originalRequest: HttpRequest,
|
|
26
32
|
options?: RequestPresigningArguments
|
|
27
33
|
): Promise<HttpRequest>;
|
|
34
|
+
presignWithCredentials(
|
|
35
|
+
originalRequest: HttpRequest,
|
|
36
|
+
credentials: AwsCredentialIdentity,
|
|
37
|
+
options?: RequestPresigningArguments
|
|
38
|
+
): Promise<HttpRequest>;
|
|
28
39
|
private getSigv4aSigner;
|
|
29
40
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AwsCredentialIdentity } from "@aws-sdk/types";
|
|
2
|
+
import {
|
|
3
|
+
HttpRequest,
|
|
4
|
+
RequestPresigner,
|
|
5
|
+
RequestSigner,
|
|
6
|
+
RequestSigningArguments,
|
|
7
|
+
} from "@smithy/types";
|
|
2
8
|
export type OptionalCrtSignerV4 = {
|
|
3
|
-
new (options: any): RequestPresigner &
|
|
9
|
+
new (options: any): RequestPresigner &
|
|
10
|
+
RequestSigner & {
|
|
11
|
+
signWithCredentials(
|
|
12
|
+
requestToSign: HttpRequest,
|
|
13
|
+
credentials: AwsCredentialIdentity,
|
|
14
|
+
options: RequestSigningArguments
|
|
15
|
+
): Promise<HttpRequest>;
|
|
16
|
+
};
|
|
4
17
|
};
|
|
5
18
|
export declare const signatureV4CrtContainer: {
|
|
6
19
|
CrtSignerV4: null | OptionalCrtSignerV4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/signature-v4-multi-region",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.461.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@aws-sdk/middleware-sdk-s3": "3.461.0",
|
|
23
24
|
"@aws-sdk/types": "3.460.0",
|
|
24
25
|
"@smithy/protocol-http": "^3.0.9",
|
|
25
26
|
"@smithy/signature-v4": "^2.0.0",
|