@aws-sdk/signature-v4

  • Version 3.178.0
  • Published
  • 194 kB
  • 6 dependencies
  • Apache-2.0 license

Install

npm i @aws-sdk/signature-v4
yarn add @aws-sdk/signature-v4
pnpm add @aws-sdk/signature-v4

Overview

A standalone implementation of the AWS Signature V4 request signing algorithm

Index

Functions

function createScope

createScope: (shortDate: string, region: string, service: string) => string;
  • Create a string describing the scope of credentials used to sign a request.

    Parameter shortDate

    The current calendar date in the form YYYYMMDD.

    Parameter region

    The AWS region in which the service resides.

    Parameter service

    The service to which the signed request is being sent.

function getCanonicalHeaders

getCanonicalHeaders: (
{ headers }: HttpRequest,
unsignableHeaders?: Set<string> | undefined,
signableHeaders?: Set<string> | undefined
) => HeaderBag;

function getCanonicalQuery

getCanonicalQuery: ({ query }: HttpRequest) => string;

function getPayloadHash

getPayloadHash: (
{ headers, body }: HttpRequest,
hashConstructor: HashConstructor
) => Promise<string>;

function getSigningKey

getSigningKey: (
sha256Constructor: HashConstructor,
credentials: Credentials,
shortDate: string,
region: string,
service: string
) => Promise<Uint8Array>;
  • Derive a signing key from its composite parts

    Parameter sha256Constructor

    A constructor function that can instantiate SHA-256 hash objects.

    Parameter credentials

    The credentials with which the request will be signed.

    Parameter shortDate

    The current calendar date in the form YYYYMMDD.

    Parameter region

    The AWS region in which the service resides.

    Parameter service

    The service to which the signed request is being sent.

function moveHeadersToQuery

moveHeadersToQuery: (
request: HttpRequest,
options?: { unhoistableHeaders?: Set<string> }
) => HttpRequest & { query: QueryParameterBag };

function prepareRequest

prepareRequest: (request: HttpRequest) => HttpRequest;

Classes

class SignatureV4

class SignatureV4
implements RequestPresigner, RequestSigner, StringSigner, EventSigner {}

    constructor

    constructor({
    applyChecksum,
    credentials,
    region,
    service,
    sha256,
    uriEscapePath,
    }: SignatureV4Init & SignatureV4CryptoInit);

      method presign

      presign: (
      originalRequest: HttpRequest,
      options?: RequestPresigningArguments
      ) => Promise<HttpRequest>;

        method sign

        sign: {
        (stringToSign: string, options?: SigningArguments): Promise<string>;
        (event: FormattedEvent, options: EventSigningArguments): Promise<string>;
        (
        requestToSign: HttpRequest,
        options?: RequestSigningArguments
        ): Promise<HttpRequest>;
        };

          Interfaces

          interface SignatureV4CryptoInit

          interface SignatureV4CryptoInit {}

            property sha256

            sha256: HashConstructor;

              interface SignatureV4Init

              interface SignatureV4Init {}

                property applyChecksum

                applyChecksum?: boolean;
                • Whether to calculate a checksum of the request body and include it as either a request header (when signing) or as a query string parameter (when presigning). This is required for AWS Glacier and Amazon S3 and optional for every other AWS service as of late 2017.

                  [true]

                property credentials

                credentials: Credentials | Provider<Credentials>;
                • The credentials with which the request should be signed or a function that returns a promise that will be resolved with credentials.

                property region

                region: string | Provider<string>;
                • The region name or a function that returns a promise that will be resolved with the region name.

                property service

                service: string;
                • The service signing name.

                property sha256

                sha256?: HashConstructor;
                • A constructor function for a hash object that will calculate SHA-256 HMAC checksums.

                property uriEscapePath

                uriEscapePath?: boolean;
                • Whether to uri-escape the request URI path as part of computing the canonical request string. This is required for every AWS service, except Amazon S3, as of late 2017.

                  [true]

                Package Files (8)

                Dependencies (6)

                Dev Dependencies (9)

                Peer Dependencies (0)

                No peer dependencies.

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-sdk/signature-v4.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@aws-sdk/signature-v4)
                • HTML
                  <a href="https://www.jsdocs.io/package/@aws-sdk/signature-v4"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>