Socket
Socket
Sign inDemoInstall

@acusti/aws-signature-v4

Package Overview
Dependencies
1
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @acusti/aws-signature-v4

A lightweight isomorphic module to generate request headers that fulfill the AWS SigV4 signing process


Version published
Weekly downloads
3
decreased by-40%
Maintainers
1
Install size
54.8 kB
Created
Weekly downloads
 

Readme

Source

@acusti/aws-signature-v4

latest version maintenance status downloads per month install size

aws-signature-v4 is a lightweight isomorphic module that generates request headers to fulfill the AWS SigV4 signing process.

Usage

npm install @acusti/aws-signature-v4
# or
yarn add @acusti/aws-signature-v4

The primary export is getHeadersWithAuthorization, an async function that takes three arguments: a resource (i.e. request URL), a fetch init object (i.e. request options), and an AWS options object where you can pass credentials, the region, and the service name (see the type definition). If the AWS region isn’t passed and can be derived from the resource URL, it will be. The function’s return promise is resolved with a plain JS object of the request’s headers with all required authorization headers merged in over top of any existing headers passed to the function.

import { getHeadersWithAuthorization } from '@acusti/aws-signature-v4';

const resource = 'https://_.appsync-api.us-west-2.amazonaws.com/graphql';
const body = `{"query": "query { listItems { items { id } } }"}`;

const headers = await getHeadersWithAuthorization(
    resource,
    { body, headers: { method: 'POST' } },
    {
        accessKeyId: '…',
        region: 'us-west-2',
        secretAccessKey: '…',
        service: 'appsync',
        sessionToken: '…',
    },
);

const response = await fetch(resource, { body, headers });

Keywords

FAQs

Last updated on 22 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc