I am writing a Post Man test, using javascript, to verify that a certain part of the api response is correct. The whole api response comes back as json. But, one part of this json response is base64 encrypted, 128 bit encrypted, and also compressed. So, I store this one part of the json response in a variable. Then, I base 64 decode that and store it into a second variable. Finally, I 128 bit decrypt and store this into a third variable.
My issue now is that I want to decompress the data in this third variable. To be clear, this is now a subset of the original api response that came back from the server. It has been base64 decoded and 128 bit decrypted. Now, I need to decompress it. All of the research I have found deals with unzipping a .zip file. I cannot use that because I do not have this information stored in a file. I have this information stored in a variable.
So, has anyone been able to decompress data that is stored in a variable instead of being stored in a .zip, .jar, or other file type?
======================================= So that it's also more tangile for you to understand, here is a close example of what I am trying:
var jsonData = pm.response.json();
//rawResponse is a subset of the json response, and the part we need to test later, but here its still encrypted and compressed
var rawResponse = jsonData.field[2].data;
//base 64 decode
var base64Decoded = atob(rawResponse);
//our key for the 128 bit decryption
var key = 1234ourmadeupkeyhere; //actual key works when used, but obviously not listed here
//Do the 128 bit decrypting
var decryptedData = CryptoJS.AES.decrypt(base64Decoded, key);
//In this variable decompressedData, this is the data we need to decompress
var decompressedData = howDoIDecompressThisHere(decryptedData );
//Assertion
pm.expect(decompressedData).to.be.equal("blahblahblah something readable and no longer compressed");```