Third party libraries
Our API monitoring environment comes packaged with the following third party libraries that can be readily used in your tests.
- axios - v0.27.2
- chai.js - v4.3.6
- crypto.js - v4.1.1
- expect - v28.1.0
- lodash - v4.17.21
- moment - v2.29.3
- faker - v6.3.1
Import or use of any other third party libraries is not supported.
Also, we do not support accessing filesystem APIs in your test scripts.
If you have specific requirements to use any other third-party libraries, please reach out to Support. We do not guarantee that we will support such requests, but we may include more libraries in the future based on requests from customers.
Following is an example script that shows how CryptoJS can be used:
const CryptoJS = require('crypto-js');
const message = "a message";
//hashing examples
console.log("MD5 = " + CryptoJS.MD5(message).toString()); //md5
console.log("SHA1 = " + CryptoJS.SHA1(message).toString()); //SHA1
console.log("SHA256 = " + CryptoJS.SHA256(message).toString()); //SHA 256
//encoding examples
var wordArray = CryptoJS.enc.Utf8.parse(message);
const base64Encoded = CryptoJS.enc.Base64.stringify(wordArray);
console.log(`Base64 Encoded = ${base64Encoded}`);
console.log("Base64 Decoded = " + CryptoJS.enc.Base64.parse(base64Encoded).toString(CryptoJS.enc.Utf8)); //base64 decode
//encryption examples
const secret = 'a secret';
const aesEncryptedText = CryptoJS.AES.encrypt(message, secret).toString(); //encrypt with a secret using AES
console.log("AES CipherText = " + aesEncryptedText);
const aesDecryptedText = CryptoJS.AES.decrypt(aesEncryptedText, secret).toString(CryptoJS.enc.Utf8); //decrypt the cipher using secret
console.log("AES DecryptedText = " + aesDecryptedText);
const desEncryptedText = CryptoJS.DES.encrypt(message, secret).toString();
console.log("DES CipherText = " + desEncryptedText);
const desDecryptedText = CryptoJS.DES.decrypt(desEncryptedText, secret).toString(CryptoJS.enc.Utf8);
console.log("DES DecryptedText = " + desDecryptedText);`