JSPM

@fgiova/aws-signature

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 412
  • Score
    100M100P100Q113088F
  • License MIT

Package Exports

  • @fgiova/aws-signature
  • @fgiova/aws-signature/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@fgiova/aws-signature) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

threaded AWS Signature V4

NPM version CI workflow TypeScript

Description

This module makes it easy to sign AWS requests with the Signature V4 algorithm, using a simple interface.
Each request is signed in a separate thread, so that the main thread is not blocked.
The module use lru-cache to cache the signing keys, so that the same key is not computed twice.

Install

npm i @fgiova/aws-signature

Usage

const { signRequest } = require("@fgiova/aws-signature");

const signature = signRequest({
            method: "POST",
            path: "/",
            headers: {
                host: "foo.us-bar-1.amazonaws.com",
            },
            body: "Action=SendMessage&MessageBody=test&Version=2012-11-05",
        }, "sqs");

API

signRequest(request: Request, service: string, region?: string, date?: Date): string

Environment variables

  • AWS_ACCESS_KEY_ID - The AWS access key ID to sign the request with.
  • AWS_SECRET_ACCESS_KEY - The AWS secret access key to sign the request with.
  • AWS_REGION - The AWS region to sign the request for

Parameters

  • request - The request to sign. It can be a string, a buffer, or an object with the following properties:
    • method - The HTTP method of the request.
    • path - The path of the request.
    • headers - The headers of the request.
    • body - The body of the request.
    • query - The query string of the request.
  • service - The AWS service to sign the request for.
  • region - The AWS region to sign the request for. If not specified, the region will be extracted from the env AWS_REGION
  • date - The date to sign the request for. If not specified, the date will be now

Returns

The signature of the request, as a string.

License

Licensed under MIT.