1.0.0 • Published 4 years ago

@antavo/api-signature-node v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

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)