Skip to content

Commit

Permalink
chore(signature-v4-multi-region): de-async getSigV4a owing to containers
Browse files Browse the repository at this point in the history
  • Loading branch information
siddsriv committed Jul 10, 2024
1 parent 9cd37b2 commit 6ee80ba
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/signature-v4-multi-region/src/SignatureV4MultiRegion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
RequestSigningArguments,
} from "@smithy/types";

import { OptionalSigV4aSigner, signatureV4aContainer } from "./signature-v4a-container";
import { OptionalCrtSignerV4, signatureV4CrtContainer } from "./signature-v4-crt-container";
import { OptionalSigV4aSigner, signatureV4aContainer } from "./signature-v4a-container";

/**
* @internal
Expand Down Expand Up @@ -39,8 +39,7 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {

public async sign(requestToSign: HttpRequest, options: RequestSigningArguments = {}): Promise<HttpRequest> {
if (options.signingRegion === "*") {
const signer = await this.getSigv4aSigner();
return signer.sign(requestToSign, options);
return this.getSigv4aSigner().sign(requestToSign, options);
}
return this.sigv4Signer.sign(requestToSign, options);
}
Expand All @@ -54,16 +53,14 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {
options: RequestSigningArguments = {}
): Promise<HttpRequest> {
if (options.signingRegion === "*") {
const signer = await this.getSigv4aSigner();
return signer.signWithCredentials(requestToSign, credentials, options);
return this.getSigv4aSigner().signWithCredentials(requestToSign, credentials, options);
}
return this.sigv4Signer.signWithCredentials(requestToSign, credentials, options);
}

public async presign(originalRequest: HttpRequest, options: RequestPresigningArguments = {}): Promise<HttpRequest> {
if (options.signingRegion === "*") {
const signer = await this.getSigv4aSigner();
return signer.presign(originalRequest, options);
return this.getSigv4aSigner().presign(originalRequest, options);
}
return this.sigv4Signer.presign(originalRequest, options);
}
Expand All @@ -79,7 +76,7 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner {
return this.sigv4Signer.presignWithCredentials(originalRequest, credentials, options);
}

private async getSigv4aSigner(): Promise<InstanceType<OptionalCrtSignerV4> | InstanceType<OptionalSigV4aSigner>> {
private getSigv4aSigner(): InstanceType<OptionalCrtSignerV4> | InstanceType<OptionalSigV4aSigner> {
if (!this.sigv4aSigner) {
if (signatureV4CrtContainer.CrtSignerV4) {
// CRT implementation
Expand Down

0 comments on commit 6ee80ba

Please sign in to comment.