2.0.7 • Published 5 years ago

cloudfront-private-url-creator v2.0.7

Weekly downloads
39
License
ISC
Repository
github
Last release
5 years ago

cloudfront-private-url-creator

Creates and signs private Cloudfront Urls (http:, https:, rtmp:, rtmpt:, rtmpe:, and rtmpte:)

travis npm downloads standard

Installation:

npm i cloudfront-private-url-creator

Note:

If you are using Node 0.10 - 0.12, please use version 1.1.0.

Usage:

'use strict'
const fs = require('fs')
const cf = require('cloudfront-private-url-creator')

const urlToSign = 'https://somedistro.cloudfront.net/somefolder/someFile'
const keyPairId = 'yourKeyPaidId'
const privateKeyPath = './yourKey.pem'

// date when the private url will expire (1 hour from now in this case)
const dateLessThan = new Date()
dateLessThan.setHours(dateLessThan.getHours() + 1)

const privateKey = fs.readFileSync(privateKeyPath)

const config = {
  privateKey,
  keyPairId,
  dateLessThan
}
// sign the url and return it, or just get the signature
const signatureQueryString = cf.getSignatureQueryString(urlToSign, config)
// OR
const signedUrl = cf.signUrl(urlToSign, config)

Relevant AWS docs:

Creating a Signed URL Using a Canned Policy

Creating a Signed URL Using a Custom Policy

Contributors

Here's a list, thanks for your help!

2.0.7

5 years ago

2.0.6

6 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.0

9 years ago

1.0.51

10 years ago

1.0.50

10 years ago

1.0.49

10 years ago

1.0.48

10 years ago

1.0.47

10 years ago

1.0.46

10 years ago

1.0.45

10 years ago

1.0.44

10 years ago

1.0.43

11 years ago

1.0.42

11 years ago

1.0.41

11 years ago

1.0.4

11 years ago

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago