title: Using JavaScript to properly sign a string using HmacSHA256
body: <p>In the Houndify API Docs for Authentication, you have the following block of content:</p>
  
  <hr>
  
  <h3>An Example of Authenticating a Request</h3>
  
  <p>Let's assume we have the following information:</p>
  
  <pre><code>UserID: ae06fcd3-6447-4356-afaa-813aa4f2ba41
      RequestID: 70aa7c25-c74f-48be-8ca8-cbf73627c05f
      Timestamp: 1418068667   
      ClientID: KFvH6Rpy3tUimL-pCUFpPg==
      ClientKey: KgMLuq-k1oCUv5bzTlKAJf_mGo0T07jTogbi6apcqLa114CCPH3rlK4c0RktY30xLEQ49MZ-C2bMyFOVQO4PyA==
  </code></pre>
  
  <ol>
  <li><p>Concatenate the UserID string, RequestID string, and TimeStamp string in the following format: <code>{user_id};{request_id}{timestamp}</code></p></li>
  <li><p>With the values from the example, the expected output would be in this case: <code>ae06fcd3-6447-4356-afaa-813aa4f2ba41;70aa7c25-c74f-48be-8ca8-cbf73627c05f1418068667</code></p></li>
  <li><p>Sign the message with the decoded ClientKey. The result is a 32-byte binary string (which we can’t represent visually). After base-64 encoding, however, the signature is: <code>myWdEfHJ7AV8OP23v8pCH1PILL_gxH4uDOAXMi06akk=</code></p></li>
  <li><p>The client then generates two authentication headers <em>Hound-Request-Authentication</em> and <em>Hound-Client-Authentication</em>.</p></li>
  <li><p>The Hound-Request-Authentication header is composed by concatenating the UserID and RequestID in the following format: <code>{user-id};{request-id}</code>. Continuing the example above, the value for this header would be:
  Hound-Request-Authentication: <code>ae06fcd3-6447-4356-afaa-813aa4f2ba41;70aa7c25-c74f-48be-8ca8-cbf73627c05f</code></p></li>
  <li><p>The Hound-Client-Authentication header is composed by concatening the ClientID, the TimeStamp string and the signature in the following format: <code>{client-id};{timestamp};{signature}</code>. Continuing the example above, the value for this header would be: <code>Hound-Client-Authentication: KFvH6Rpy3tUimL-pCUFpPg==;1418068667;myWdEfHJ7AV8OP23v8pCH1PILL_gxH4uDOAXMi06akk=</code></p></li>
  </ol>
  
  <hr>
  
  <p>For Number 3, it says "Sign the message with the decoded ClientKey". The "message" and "ClientKey" are two distinct strings.</p>
  
  <p>My question(s): How do you sign one string with another string i.e. what exactly does that mean? And how would you do that in JavaScript?</p>
  
  <pre><code>var message = 'my_message';
  var key = 'signing_key';
  
  //??what next??
  </code></pre>
  
  <p>I'm trying to figure all this out so I can create a pre-request script in Postman to do a proper HmacSHA256 hash.</p>