GithubHelp home page GithubHelp logo

bizzylabs / aws-cloudfront-sign-old Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jasonsims/aws-cloudfront-sign

0.0 3.0 0.0 106 KB

Utility module for AWS CloudFront

License: MIT License

JavaScript 100.00%

aws-cloudfront-sign-old's Introduction

AWS CloudFront URL Signature Utility

Circle CI

Generating signed URLs for CloudFront links is a little more tricky than for S3. It's because signature generation for S3 URLs is handled a bit differently than CloudFront URLs and this functionality is not currently supported by the aws-sdk library for JavaScript. In case you also need to do this, I've created this simple utility to make things easier.

Setup

###Configure CloudFront

  1. Create a CloudFront distribution

  2. Configure your origin with the following settings:

    Origin Domain Name: {your-s3-bucket}
    Restrict Bucket Access: Yes
    Grant Read Permissions on Bucket: Yes, Update Bucket Policy

  3. Create CloudFront Key Pair.

###Installation ย  npm version

npm install aws-cloudfront-sign

###Usage

var cf = require('aws-cloudfront-sign')
var params = {
  keypairId: process.env.PUBLIC_KEY,
  privateKeyString: process.env.PRIVATE_KEY,
  privateKeyPath: '/path/to/private/key',      // Optional. Use as an alternative to privateKeyString.
  expireTime: new Date(2016, 0, 1) // January 1, 2016
}
var signedUrl = cf.getSignedUrl('http://example.com/path/to/s3/object', params);
console.log('Signed URL: ' + signedUrl);

var signedRTMPUrlObj = cf.getSignedRTMPUrl('xxxxxxx.cloudfront.net', 'path/to/s3/object', params);
console.log('RTMP Server Path: ' + signedRTMPUrlObj.rtmpServerPath);
console.log('Signed Stream Name: ' + signedRTMPUrlObj.rtmpStreamName);

aws-cloudfront-sign-old's People

Contributors

alexsaves avatar gregt590 avatar jasonsims avatar tbuchok avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.