UNPKG

@hclsoftware/secagent

Version:

IAST agent

31 lines (25 loc) 827 B
//IASTIGNORE /* * **************************************************** * Licensed Materials - Property of HCL. * (c) Copyright HCL Technologies Ltd. 2017, 2025. * Note to U.S. Government Users *Restricted Rights. * **************************************************** */ const pako = require("pako"); const iastLogger = require("../Logger/IastLogger"); module.exports.encodeUrl = (str) => { return encodeURIComponent(str); } module.exports.gzip = (encodedUrlText) => { // Convert the URL-encoded string to Uint8Array try{ const uint8Array = new Uint8Array(Buffer.from(encodedUrlText, "utf-8")) return pako.gzip(uint8Array); } catch (error) { iastLogger.eventLog.error(error) } } module.exports.encodeBase64 = (data) => { return Buffer.from(data).toString('base64'); }