@antavo/api-signature-node

Antavo API Signature helps you creating secure HTTP requests (for APIs) by signing HTTP(s) requests.

Usage no npm install needed!

<script type="module">
  import antavoApiSignatureNode from 'https://cdn.skypack.dev/@antavo/api-signature-node';
</script>

README

Antavo API Signature

Antavo API Signature helps you creating secure HTTP requests (for APIs) by signing HTTP(s) requests.

Usage

  1. Create a timestamp integer through the following snippet:

    var time = 1 * (new Date().getTime() / 1000).toFixed(0)
    
  2. Initialize a new Signer object this way:

    var signer = new Signer(ENVIRONMENT, API_KEY, API_SECRET, time)
    
  3. Calculate the signature string like this:

    var signature = signer.calculateSignature(HTTP_METHOD, REQUEST_URL, REQUEST_DATA)
    
  4. Create the Authorization header, and append it to the request:

    var header = signer.getAuthorizationHeader(signature)