Created
February 23, 2021 21:09
-
-
Save pixelpylon/d94788e3861e26bd3e04a76b022bf2ef to your computer and use it in GitHub Desktop.
postman pre-script to obtain bokun signature
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
const moment = require('moment'); | |
let timestamp = moment().utc().format("YYYY-MM-DD HH:mm:ss"); | |
pm.globals.set("timestamp", timestamp); | |
const access = "ACCESS_KEY"; | |
let csting = timestamp+access+"GET"+pm.request.url.getPathWithQuery(); | |
const secret = "SECRET_KEY"; | |
const hmac = CryptoJS.HmacSHA1(csting, secret); | |
const signature = hmac.toString(CryptoJS.enc.Base64); | |
pm.globals.set("signature", signature); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment