lib/cloudfront/signer.js
function (options, cb) {
        var signatureHash = 'policy' in options
            ? signWithCustomPolicy(options.policy, this.keyPairId, this.privateKey)
            : signWithCannedPolicy(options.url, options.expires, this.keyPairId, this.privateKey);

        var cookieHash = {};
        for (var key in signatureHash) {
            if (Object.prototype.hasOwnProperty.call(signatureHash, key)) {
                cookieHash['CloudFront-' + key] = signatureHash[key];
            }
        }

        return handleSuccess(cookieHash, cb);
    }
function (options, cb) {
        var signatureHash = 'policy' in options
            ? signWithCustomPolicy(options.policy, this.keyPairId, this.privateKey)
            : signWithCannedPolicy(options.url, options.expires, this.keyPairId, this.privateKey);

        var cookieHash = {};
        for (var key in signatureHash) {
            if (Object.prototype.hasOwnProperty.call(signatureHash, key)) {
                cookieHash['CloudFront-' + key] = signatureHash[key];
            }
        }

        return handleSuccess(cookieHash, cb);
    }
function ( options , cb ) { var signatureHash = 'policy' in options ? signWithCustomPolicy ( options . policy , this . keyPairId , this . privateKey ) : signWithCannedPolicy ( options . url , options . expires , this . keyPairId , this . privateKey ) ; var cookieHash = { } ; for ( var key in signatureHash ) { if ( Object . prototype . hasOwnProperty . call ( signatureHash , key ) ) { cookieHash [ 'CloudFront-' + key ] = signatureHash [ key ] ; } } return handleSuccess ( cookieHash , cb ) ; }
Create a signed Amazon CloudFront Cookie.

@param options [Object]            The options to create a signed cookie.
@option options url [String]     The URL to which the signature will grant
access. Required unless you pass in a full
policy.
@option options expires [Number] A Unix UTC timestamp indicating when the
signature should expire. Required unless you
pass in a full policy.
@option options policy [String]  A CloudFront JSON policy. Required unless
you pass in a url and an expiry time.

@param cb [Function] if a callback is provided, this function will
pass the hash as the second parameter (after the error parameter) to
the callback function.

@return [Object] if called synchronously (with no callback), returns the
signed cookie parameters.
@return [null] nothing is returned if a callback is provided.
Create a signed Amazon CloudFront Cookie .