cloudfront-signer

4.1.0 • Public • Published

CloudFront Signer Build Status

Sign urls with canned or custom policy

Notice: Use aws-sdk library rather, this one was done before I knew about it, and inspired from aws-cloudfront-sign

// canned:
const cfSign = require('cloudfront-signer');
 
const expire = Math.floor((Date.now()+86400e3)*0.001); // expire in one day
const url = 'http://xyz.cloudfront.net/test/cool?fun=1';
const signedUrl = url + '&' + cfSign(url, expire, cfKeypairId, cfPrivateKey)
// custom (allow wildcards):
const cfSign = require('cloudfront-signer');
 
const expire = Math.floor((Date.now()+86400e3)*0.001); // expire in one day
const qs = cfSign('http://xyz.cloudfront.net/test/*', expire, cfKeypairId, cfPrivateKey)
// valid for 'http://xyz.cloudfront.net/test/test/bar?' + qs
// valid for 'http://xyz.cloudfront.net/test/test/cool?fun=1&' + qs

Readme

Keywords

Package Sidebar

Install

npm i cloudfront-signer

Weekly Downloads

304

Version

4.1.0

License

ISC

Last publish

Collaborators

  • caub