Last active
May 25, 2021 16:25
-
-
Save yippeykeiyay/8511c06636f59024004250a0e3128ed1 to your computer and use it in GitHub Desktop.
Postman public & private key hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Place this in your Pre-request Script section of your Postman calls to the RapidSpike API. | |
* | |
* Then add this query string to your request URLs: `?public_key={{publicKey}}&time={{unixTime}}&signature={{signature}}` | |
*/ | |
var publicKey = 'put-your-public-key'; | |
var privateKey = 'put-your-private-key-here'; | |
var unixTime = Math.floor(Date.now() / 1000); | |
var pack = publicKey + "\n" + unixTime; | |
var hash = CryptoJS.HmacSHA1(pack, privateKey); | |
var signature = encodeURIComponent(hash.toString(CryptoJS.enc.Base64)); | |
// Place the required variables into the environment to use in the query string (see above) | |
pm.environment.set("publicKey", publicKey); | |
pm.environment.set("unixTime", unixTime); | |
pm.environment.set("signature", signature); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment