Socket
Socket
Sign inDemoInstall

@aws-sdk/cloudfront-signer

Package Overview
Dependencies
Maintainers
5
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/cloudfront-signer

This package provides functions to generate signed urls and cookies for accessing private content on CloudFront based on a CloudFront trusted key group key pair.


Version published
Maintainers
5
Created

What is @aws-sdk/cloudfront-signer?

@aws-sdk/cloudfront-signer is a package within the AWS SDK for JavaScript that allows you to create signed URLs and signed cookies for Amazon CloudFront. This is useful for controlling access to your content by generating URLs and cookies that are valid for a limited time or for specific IP addresses.

What are @aws-sdk/cloudfront-signer's main functionalities?

Create Signed URL

This feature allows you to create a signed URL for a CloudFront distribution. The signed URL will be valid for a specified period, allowing temporary access to the content.

const { getSignedUrl } = require('@aws-sdk/cloudfront-signer');

const url = 'https://example.cloudfront.net/myfile.jpg';
const privateKey = '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----';
const keyPairId = 'APKA...';
const options = {
  url,
  keyPairId,
  privateKey,
  expireTime: Math.floor(Date.now() / 1000) + 3600 // 1 hour from now
};

const signedUrl = getSignedUrl(options);
console.log(signedUrl);

Create Signed Cookies

This feature allows you to create signed cookies for a CloudFront distribution. The signed cookies will be valid for a specified period, allowing temporary access to the content.

const { getSignedCookies } = require('@aws-sdk/cloudfront-signer');

const url = 'https://example.cloudfront.net/myfile.jpg';
const privateKey = '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----';
const keyPairId = 'APKA...';
const options = {
  url,
  keyPairId,
  privateKey,
  expireTime: Math.floor(Date.now() / 1000) + 3600 // 1 hour from now
};

const signedCookies = getSignedCookies(options);
console.log(signedCookies);

Other packages similar to @aws-sdk/cloudfront-signer

FAQs

Package last updated on 14 Jun 2024

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