title: Axios Encrypted POST parameters
body: <p>I want to use the API from bitgrail (docs: <a href="https://bitgrail.com/api-documentation" rel="nofollow noreferrer">https://bitgrail.com/api-documentation</a>). And request the amount of balances. To do that you have to set a SIGNATURE which includes the encrypted post parameters using HMAC-SHA512 with ur API-Secret.</p>
  <p>So you have to sent this data:</p>
  <p>Header:</p>
  <blockquote>
  <p>KEY - Public API key</p>
  <p>SIGNATURE - encrypted POST parameters with HMAC-SHA512 alghoritm using your secret API key</p>
  </blockquote>
  <p>Data:</p>
  <blockquote>
  <p>nonce - Integer number, always greater then nonce of previous call.</p>
  </blockquote>
  <p>But everytime I try to send the request I get an 'Authentication failed'-Error from Bitgrail.</p>
  <p>The params are set like so:</p>
  <pre><code>params = {}
  params.nonce = n();
  </code></pre>
  <p>and then encrypted like this:</p>
  <pre><code> let hmac = crypto.createHmac('sha512', 'MYSECRET');
   let digest = hmac.update(params.toString()).digest('hex');
   let signature = new Buffer(digest).toString('base64');
  </code></pre>
  <p>Maybe the 'params.toString()' is not working. Do I have to set the params variable as an array?</p>