Home Reference Source Repository

Function

Static Public Summary
public

addAuthorization(request: *, authorization: *): string

public

authorization(algorithm: *, accessKeyId: *, credentialScope: *, signedHeaders: *, signature: *): string

public

canonicalRequest(httpRequestMethod: string, canonicalURI: string, canonicalQueryString: string, canonicalHeaders: string, signedHeaders: string, requestPayload: string): string

public

Formats a Date object to an AWS date string

public

hash(data: string): string

Computes the hash

public

parseHead(head: *): {method: string, requestURI: string, httpVersion: string, headers: Array<string>}

public

parseRequest(request: *): {head: *, body: *}

public

querystringify(action: *, algorithm: *, accessKeyId: *, credentialScope: *, date: *, timeoutInterval: *, signedHeaders: *, signature: *): *

public
public

sign(secretAccessKey: string, date: string, region: string, service: string, stringToSign: string): string

public

stringToSign(algorithm: string, requestDate: string, credentialScope: string, hashedCanonicalRequest: string): string

Static Public

public addAuthorization(request: *, authorization: *): string source

import {addAuthorization} from 'aws-sigv4/src/index.es6'

Params:

NameTypeAttributeDescription
request *
authorization *

Return:

string

public authorization(algorithm: *, accessKeyId: *, credentialScope: *, signedHeaders: *, signature: *): string source

import {authorization} from 'aws-sigv4/src/index.es6'

Creates the authorization string https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html

Params:

NameTypeAttributeDescription
algorithm *
accessKeyId *
credentialScope *
signedHeaders *
signature *

Return:

string

public canonicalRequest(httpRequestMethod: string, canonicalURI: string, canonicalQueryString: string, canonicalHeaders: string, signedHeaders: string, requestPayload: string): string source

import {canonicalRequest} from 'aws-sigv4/src/index.es6'

Creates the canonical request https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html

Params:

NameTypeAttributeDescription
httpRequestMethod string
  • nullable: false

The HTTP request method (e.g. GET or POST)

canonicalURI string
  • nullable: false

The canonical URI

canonicalQueryString string
  • nullable: false

The canonical query string

canonicalHeaders string
  • nullable: false

The canonical headers

signedHeaders string
  • nullable: false

The signed headers

requestPayload string
  • nullable: false

The payload of the request

Return:

string

The canonical request

public formatDateTime(date: Date): string source

import {formatDateTime} from 'aws-sigv4/src/index.es6'

Formats a Date object to an AWS date string

Params:

NameTypeAttributeDescription
date Date
  • nullable: false

The date

Return:

string

The formatted date string

public hash(data: string): string source

import {hash} from 'aws-sigv4/src/index.es6'

Computes the hash

Params:

NameTypeAttributeDescription
data string
  • nullable: false

The data to hash

Return:

string

The hashed output

public parseHead(head: *): {method: string, requestURI: string, httpVersion: string, headers: Array<string>} source

import {parseHead} from 'aws-sigv4/src/index.es6'

Params:

NameTypeAttributeDescription
head *

Return:

{method: string, requestURI: string, httpVersion: string, headers: Array<string>}

public parseRequest(request: *): {head: *, body: *} source

import {parseRequest} from 'aws-sigv4/src/index.es6'

Params:

NameTypeAttributeDescription
request *

Return:

{head: *, body: *}

public querystringify(action: *, algorithm: *, accessKeyId: *, credentialScope: *, date: *, timeoutInterval: *, signedHeaders: *, signature: *): * source

import {querystringify} from 'aws-sigv4/src/index.es6'

Params:

NameTypeAttributeDescription
action *
algorithm *
accessKeyId *
credentialScope *
date *
timeoutInterval *
signedHeaders *
signature *

Return:

*

public requestToCanonicalRequest(request: *): string source

import {requestToCanonicalRequest} from 'aws-sigv4/src/index.es6'

Params:

NameTypeAttributeDescription
request *

Return:

string

public sign(secretAccessKey: string, date: string, region: string, service: string, stringToSign: string): string source

import {sign} from 'aws-sigv4/src/index.es6'

Calculates the signature https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html

Params:

NameTypeAttributeDescription
secretAccessKey string
  • nullable: false

The secret access key for the AWS account

date string
  • nullable: false

The date in YYYYMMDD format

region string
  • nullable: false

The AWS region (e.g. us-east-1)

service string
  • nullable: false

The AWS service (e.g. iam)

stringToSign string
  • nullable: false

The string to sign

Return:

string

The signature

public stringToSign(algorithm: string, requestDate: string, credentialScope: string, hashedCanonicalRequest: string): string source

import {stringToSign} from 'aws-sigv4/src/index.es6'

Creates the string to sign https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html

Params:

NameTypeAttributeDescription
algorithm string
  • nullable: false

The algorithm (AWS4-HMAC-SHA256)

requestDate string
  • nullable: false

The request date (YYYMMDDThhmmssZ)

credentialScope string
  • nullable: false

the credential scope (formatted as YYYYMMDD/region/service/aws4_request)

hashedCanonicalRequest string
  • nullable: false

Return:

string

The string to sign