Adding external library to postman in order to do cryptograp

what is the best way to add external cryptographic library to postman. I want to use this library in pre request script and the solution on the forum doesnt work for me :// I try with unpkg packages too but i have got “SyntaxError: Unexpected token ‘<’” error. My goal is to sign specific data with private key

Hey @mission-engineer-822 :wave:

Welcome to the Postman Community! :postman:

Could you also share the topics that you have been using to find the solution, please?

We have this Collection on our Postman Answers Public Workspace that also might be useful here:

https://www.postman.com/postman/workspace/postman-answers/collection/13455110-7a6c90f0-0062-4089-b206-27c803dc1c37

hi i used this two topics: GitHub - loveiset/RSAForPostman: add rsa encryt for postman and Example Code for Postman to generate HTTP Signature · GitHub and also like i said i try JavaScript libraries — Postman Quick Reference Guide Version 1.9.1 - January 2023 documentation this option with for example this link UNPKG - node-forge
And if i have implementation like this: `pm.sendRequest(“https://raw.githubusercontent.com/loveiset/RSAForPostman/master/forge.js”, function (err, res) {
if (err) {
console.log(err);
} else {
eval(res.text())
}

    function getPrivateKey() {
    return this.forge.pki.privateKeyFromPem(PRIVATE_KEY)
    }
    getPrivateKey()

})` i have error: Cannot read properties of undefined (reading ‘pki’).
When i remove this before forge word i have got forge not found exception or too few bytes to parse DER. So i dont know what i should do and what is the correct way to implement this

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.