lib/headers.js
function sign(custom, request) {
    /**
     * An Epoch timestamp is required for the digital signature.
     */
    let epoch = Util.epochInMilliseconds();
    /**
     * Override the generated Epoch timestamp if a timestamp was included in the
     * custom headers.
     */
    if (custom.WMSecurity && custom.WMSecurity.Timestamp) {
        epoch = custom.WMSecurity.Timestamp;
    }
    /**
     * The generated digital signature.
     */
    let signature = digitalSignature(custom, request, epoch);
    /**
     * Override the generated digital signature if a signature was included in the
     * custom headers.
     */
    if (custom.WMSecurity && custom.WMSecurity.AuthSignature) {
        signature = custom.WMSecurity.AuthSignature;
    }
    /**
     * The signed request headers according to Walmart API spec.
     */
    let signedHeaders = {
        'WM_SVC.NAME': custom.WMService.Name,
        'WM_QOS.CORRELATION_ID': custom.WMQOS.CorrelationId,
        'WM_SEC.TIMESTAMP': epoch,
        'WM_SEC.AUTH_SIGNATURE': signature,
        'WM_CONSUMER.CHANNEL.TYPE': custom.WMConsumer.Channel.Type,
        'WM_CONSUMER.ID': custom.WMConsumer.ConsumerId,
        'Accept': custom.Accept,
        'Content-Type': custom.Accept
    };
    return signedHeaders;
}
function sign(custom, request) {
    /**
     * An Epoch timestamp is required for the digital signature.
     */
    let epoch = Util.epochInMilliseconds();
    /**
     * Override the generated Epoch timestamp if a timestamp was included in the
     * custom headers.
     */
    if (custom.WMSecurity && custom.WMSecurity.Timestamp) {
        epoch = custom.WMSecurity.Timestamp;
    }
    /**
     * The generated digital signature.
     */
    let signature = digitalSignature(custom, request, epoch);
    /**
     * Override the generated digital signature if a signature was included in the
     * custom headers.
     */
    if (custom.WMSecurity && custom.WMSecurity.AuthSignature) {
        signature = custom.WMSecurity.AuthSignature;
    }
    /**
     * The signed request headers according to Walmart API spec.
     */
    let signedHeaders = {
        'WM_SVC.NAME': custom.WMService.Name,
        'WM_QOS.CORRELATION_ID': custom.WMQOS.CorrelationId,
        'WM_SEC.TIMESTAMP': epoch,
        'WM_SEC.AUTH_SIGNATURE': signature,
        'WM_CONSUMER.CHANNEL.TYPE': custom.WMConsumer.Channel.Type,
        'WM_CONSUMER.ID': custom.WMConsumer.ConsumerId,
        'Accept': custom.Accept,
        'Content-Type': custom.Accept
    };
    return signedHeaders;
}
function sign ( custom , request ) { /**
     * An Epoch timestamp is required for the digital signature.
     */ let epoch = Util . epochInMilliseconds ( ) ; /**
     * Override the generated Epoch timestamp if a timestamp was included in the
     * custom headers.
     */ if ( custom . WMSecurity && custom . WMSecurity . Timestamp ) { epoch = custom . WMSecurity . Timestamp ; } /**
     * The generated digital signature.
     */ let signature = digitalSignature ( custom , request , epoch ) ; /**
     * Override the generated digital signature if a signature was included in the
     * custom headers.
     */ if ( custom . WMSecurity && custom . WMSecurity . AuthSignature ) { signature = custom . WMSecurity . AuthSignature ; } /**
     * The signed request headers according to Walmart API spec.
     */ let signedHeaders = { 'WM_SVC.NAME' : custom . WMService . Name , 'WM_QOS.CORRELATION_ID' : custom . WMQOS . CorrelationId , 'WM_SEC.TIMESTAMP' : epoch , 'WM_SEC.AUTH_SIGNATURE' : signature , 'WM_CONSUMER.CHANNEL.TYPE' : custom . WMConsumer . Channel . Type , 'WM_CONSUMER.ID' : custom . WMConsumer . ConsumerId , 'Accept' : custom . Accept , 'Content-Type' : custom . Accept } ; return signedHeaders ; }
Returns the signed headers required for the API request.

@param custom Walmart authentication headers. Use the custom class to set custom
values to the headers before adding to the request.
@param request The request properties required to generate the digital signature.
Returns the signed headers required for the API request .