Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@smithy/signature-v4

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/signature-v4

A standalone implementation of the AWS Signature V4 request signing algorithm

  • 2.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17M
increased by0.97%
Maintainers
2
Weekly downloads
 
Created

What is @smithy/signature-v4?

@smithy/signature-v4 is an npm package used for signing AWS requests using the AWS Signature Version 4 signing process. This is essential for securely making authenticated requests to AWS services.

What are @smithy/signature-v4's main functionalities?

Signing HTTP Requests

This feature allows you to sign HTTP requests to AWS services using the AWS Signature Version 4 signing process. The code sample demonstrates how to sign a GET request to an S3 bucket.

const { SignatureV4 } = require('@smithy/signature-v4');
const { Sha256 } = require('@aws-crypto/sha256-js');
const { HttpRequest } = require('@smithy/protocol-http');

const signer = new SignatureV4({
  service: 's3',
  region: 'us-east-1',
  credentials: {
    accessKeyId: 'AKID',
    secretAccessKey: 'SECRET'
  },
  sha256: Sha256
});

const request = new HttpRequest({
  method: 'GET',
  hostname: 'examplebucket.s3.amazonaws.com',
  path: '/exampleobject'
});

signer.sign(request).then(signedRequest => {
  console.log(signedRequest);
});

Presigning URLs

This feature allows you to generate presigned URLs for AWS services, which can be used to grant temporary access to resources. The code sample demonstrates how to presign a URL for an S3 object with a 1-hour expiration.

const { SignatureV4 } = require('@smithy/signature-v4');
const { Sha256 } = require('@aws-crypto/sha256-js');
const { HttpRequest } = require('@smithy/protocol-http');
const { formatUrl } = require('@smithy/util-format-url');

const signer = new SignatureV4({
  service: 's3',
  region: 'us-east-1',
  credentials: {
    accessKeyId: 'AKID',
    secretAccessKey: 'SECRET'
  },
  sha256: Sha256
});

const request = new HttpRequest({
  method: 'GET',
  hostname: 'examplebucket.s3.amazonaws.com',
  path: '/exampleobject'
});

signer.presign(request, { expiresIn: 3600 }).then(presignedUrl => {
  console.log(formatUrl(presignedUrl));
});

Other packages similar to @smithy/signature-v4

FAQs

Package last updated on 19 Sep 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc