@aws-sdk/signature-v4-multi-region 3.460.0 → 3.465.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SignatureV4MultiRegion = void 0;
4
- const signature_v4_1 = require("@smithy/signature-v4");
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 signature_v4_1.SignatureV4(options);
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 { SignatureV4 } from "@smithy/signature-v4";
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 SignatureV4(options);
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 { RequestPresigner, RequestSigner } from "@smithy/types";
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 { RequestPresigner, RequestSigner } from "@smithy/types";
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 & RequestSigner;
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.460.0",
3
+ "version": "3.465.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,7 +20,8 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.460.0",
23
+ "@aws-sdk/middleware-sdk-s3": "3.465.0",
24
+ "@aws-sdk/types": "3.465.0",
24
25
  "@smithy/protocol-http": "^3.0.9",
25
26
  "@smithy/signature-v4": "^2.0.0",
26
27
  "@smithy/types": "^2.5.0",
@@ -31,7 +32,6 @@
31
32
  "concurrently": "7.0.0",
32
33
  "downlevel-dts": "0.10.1",
33
34
  "rimraf": "3.0.2",
34
- "typedoc": "0.23.23",
35
35
  "typescript": "~4.9.5"
36
36
  },
37
37
  "engines": {
@@ -52,8 +52,5 @@
52
52
  "type": "git",
53
53
  "url": "https://github.com/aws/aws-sdk-js-v3.git",
54
54
  "directory": "packages/signature-v4-multi-region"
55
- },
56
- "typedoc": {
57
- "entryPoint": "src/index.ts"
58
55
  }
59
56
  }