Last active
January 27, 2022 12:20
-
-
Save makerstorage/24caf27ba386dcafeb376943218097fa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # 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