UNPKG

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