CloudFront Signer
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
const cfSign = require('cloudfront-signer');
const expire = Math.floor((Date.now()+86400e3)*0.001);
const url = 'http://xyz.cloudfront.net/test/cool?fun=1';
const signedUrl = url + '&' + cfSign(url, expire, cfKeypairId, cfPrivateKey)
const cfSign = require('cloudfront-signer');
const expire = Math.floor((Date.now()+86400e3)*0.001);
const qs = cfSign('http://xyz.cloudfront.net/test/*', expire, cfKeypairId, cfPrivateKey)