Skip to content

Instantly share code, notes, and snippets.

@makerstorage
Last active January 27, 2022 12:20
Show Gist options
  • Select an option

  • Save makerstorage/24caf27ba386dcafeb376943218097fa to your computer and use it in GitHub Desktop.

Select an option

Save makerstorage/24caf27ba386dcafeb376943218097fa to your computer and use it in GitHub Desktop.
# client
¨¨¨
var accesskey = "ApiKey";
var secretkey =cryptoJs.enc.Base64.parse("secret");
var timestamp = moment(new Date()).valueOf().toString();
//postman.setGlobalVariable("X-PCK",accesskey);
//postman.setGlobalVariable("X-Stamp",timestamp);
var signatureBytes =cryptoJs.HmacSHA256(cryptoJs.enc.Utf8.parse(accesskey+timestamp),secretkey)
var signature =cryptoJs.enc.Base64.stringify(signatureBytes);
//postman.setGlobalVariable("X-Signature",signature);
msg.headers = {};
msg.headers['X-PCK'] =accesskey;
msg.headers['X-Stamp'] =timestamp;
msg.headers['X-Signature'] = signature;
return msg;
¨¨¨
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment