protected function signRequest($path, array $params, $secret, $timestamp = null)
	{
        /* If there is no secret, don't sign the request. */
        if (empty($secret)) {
            return $params;
        }

        /* Remove any existing signature, update timestamp and alphabetically sort parameters. */
        unset($params['signature']);
        $params['timestamp'] = $timestamp !== null ? $timestamp : time();
        ksort($params);

        /* Calculate signature */
        $queryString = http_build_query($params, '', '&');
        $params['signature'] = hash_hmac(
            'sha1',
            '/' . trim($path, '/') . '?' . $queryString,
            strtoupper($secret)
        );

        return $params;
    }