This is a typescript/javascript package to sign your HTTP requests using aws4 signature. This includes support for both CJS and ESM.
To get started:
# Using bun.js
bun add @sujithjr/aws4-request-auth-ts
# Using npm
npm install @sujithjr/aws4-request-auth-ts
# Using pnpm
pnpm add @sujithjr/aws4-request-auth-ts
# Using yarn
yarn add @sujithjr/aws4-request-auth-ts
Common JS require,
const awsSign = require('@sujithjr/aws4-request-auth-ts');
ES module import,
import awsSign from '@sujithjr/aws4-request-auth-ts';
Supports all the HTTP request methods. Example on how to pass required fields to sign the headers,
const headers = awsSign.signHeaders({
targetUrl: 'https//example.com',
method: 'POST',
body: JSON.stringify({ value: 'some text' }),
awsConfig: {
region: '<aws-region>',
accessKey: '<aws-access-key>',
secretKey: '<aws-secret-key>',
service: '<aws-service>',
}
})