UNPKG

1.76 kBTypeScriptView Raw
1import {
2 AwsCredentialIdentity,
3 ChecksumConstructor,
4 EventSigner,
5 EventSigningArguments,
6 FormattedEvent,
7 HashConstructor,
8 HttpRequest,
9 Provider,
10 RequestPresigner,
11 RequestPresigningArguments,
12 RequestSigner,
13 RequestSigningArguments,
14 SigningArguments,
15 StringSigner,
16} from "@aws-sdk/types";
17export interface SignatureV4Init {
18 service: string;
19 region: string | Provider<string>;
20 credentials: AwsCredentialIdentity | Provider<AwsCredentialIdentity>;
21 sha256?: ChecksumConstructor | HashConstructor;
22 uriEscapePath?: boolean;
23 applyChecksum?: boolean;
24}
25export interface SignatureV4CryptoInit {
26 sha256: ChecksumConstructor | HashConstructor;
27}
28export declare class SignatureV4
29 implements RequestPresigner, RequestSigner, StringSigner, EventSigner
30{
31 private readonly service;
32 private readonly regionProvider;
33 private readonly credentialProvider;
34 private readonly sha256;
35 private readonly uriEscapePath;
36 private readonly applyChecksum;
37 constructor({
38 applyChecksum,
39 credentials,
40 region,
41 service,
42 sha256,
43 uriEscapePath,
44 }: SignatureV4Init & SignatureV4CryptoInit);
45 presign(
46 originalRequest: HttpRequest,
47 options?: RequestPresigningArguments
48 ): Promise<HttpRequest>;
49 sign(stringToSign: string, options?: SigningArguments): Promise<string>;
50 sign(event: FormattedEvent, options: EventSigningArguments): Promise<string>;
51 sign(
52 requestToSign: HttpRequest,
53 options?: RequestSigningArguments
54 ): Promise<HttpRequest>;
55 private signEvent;
56 private signString;
57 private signRequest;
58 private createCanonicalRequest;
59 private createStringToSign;
60 private getCanonicalPath;
61 private getSignature;
62 private getSigningKey;
63 private validateResolvedCredentials;
64}