@acusti/aws-signature-v4
Version:
A lightweight isomorphic module to generate request headers that fulfill the AWS SigV4 signing process
104 lines (102 loc) • 2.71 kB
Flow
/**
* Flowtype definitions for index
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.21.0
* @flow
*/
import {
type,
AWSOptions as _AWSOptions,
type,
FetchHeaders,
type,
FetchOptions,
} from "./types.js";
export type AWSOptions = _AWSOptions;
declare type FetchOptionsWithHeaders = {|
...{|
headers: FetchHeaders,
|},
...$Diff<FetchOptions, { headers: any }>,
|};
/**
* @private Create canonical headers
*
* <pre>
* CanonicalHeaders =
* CanonicalHeadersEntry0 + CanonicalHeadersEntry1 + ... + CanonicalHeadersEntryN
* CanonicalHeadersEntry =
* Lowercase(HeaderName) + ':' + Trimall(HeaderValue) + '\n'
* </pre>
*/
declare var getCanonicalHeaders: (headers: FetchHeaders) => string;
/**
* @private The list of headers that were included in the canonical headers
* For HTTP/1.1 requests, the host header must be included as a signed header.
* For HTTP/2 requests that include the :authority header instead of the host header,
* you must include the :authority header as a signed header. If you include a date or
* x-amz-date header, you must also include that header in the list of signed headers.
*/
declare var getSignedHeaders: (headers: FetchHeaders) => string;
/**
* @private [object Object],[object Object],[object Object]
*/
declare var getCanonicalString: (
resource: string,
fetchOptions: FetchOptionsWithHeaders
) => Promise<string>;
declare var getRegionFromResource: (resource: string) => string;
declare var getCredentialScope: (x: {|
dateString: string,
region: string,
service: string,
|}) => string;
/**
* @private [object Object],[object Object]
*/
declare var getStringToSign: (x: {|
algorithm: string,
canonicalString: string,
dateTimeString: string,
scope: string,
|}) => Promise<string>;
/**
* @private [object Object],[object Object]
*/
declare var getSigningKey: (x: {|
dateString: string,
region: string,
secretAccessKey: string,
service: string,
|}) => Promise<string | Uint8Array<ArrayBuffer>>;
declare var getSignature: (
signingKey: string | Uint8Array,
stringToSign: string
) => Promise<string>;
/**
* @private [object Object],[object Object]
*/
declare var getAuthorizationHeader: (x: {|
accessKeyId: string,
algorithm: string,
scope: string,
signature: string,
signedHeaders: string,
|}) => string;
declare var getHeadersWithAuthorization: (
resource: string,
fetchOptions: FetchOptions,
x: AWSOptions
) => Promise<FetchHeaders>;
declare export {
getAuthorizationHeader,
getCanonicalHeaders,
getCanonicalString,
getCredentialScope,
getHeadersWithAuthorization,
getRegionFromResource,
getSignature,
getSignedHeaders,
getSigningKey,
getStringToSign,
};