@antavo/api-signature-node
v1.0.0
Published
Antavo API Signature helps you creating secure HTTP requests (for APIs) by signing HTTP(s) requests.
Downloads
221
Readme
Antavo API Signature
Antavo API Signature helps you creating secure HTTP requests (for APIs) by signing HTTP(s) requests.
Usage
Create a timestamp integer through the following snippet:
var time = 1 * (new Date().getTime() / 1000).toFixed(0)
Initialize a new Signer object this way:
var signer = new Signer(ENVIRONMENT, API_KEY, API_SECRET, time)
Calculate the signature string like this:
var signature = signer.calculateSignature(HTTP_METHOD, REQUEST_URL, REQUEST_DATA)
Create the Authorization header, and append it to the request:
var header = signer.getAuthorizationHeader(signature)