orderData() { const orderDataNode = this.doc.getElementsByTagNameNS('urn:org:ebics:H004', 'OrderData'); if (!orderDataNode.length) return {}; const orderData = orderDataNode[0].textContent; const decipher = crypto.createDecipheriv('aes-128-cbc', this.transactionKey(), DEFAULT_IV).setAutoPadding(false); const data = Buffer.from(decipher.update(orderData, 'base64', 'binary') + decipher.final('binary'), 'binary'); return zlib.inflateSync(data); }
function decompressWSMessage(m, f) { f = f || {}; return f.binary ? JSON.parse(Zlib.inflateSync(m).toString()) : JSON.parse(m); }
function decodeShares(packet, compressed = true) { let dirs = {}; let unzipped; if (compressed) { unzipped = packet.data.slice(packet.pointer, packet.data.length); // TODO we have to do this with async unzipped = new Message(zlib.inflateSync(unzipped)); } else { unzipped = packet; } let dirCount = unzipped.int32(); for (let i = 0; i < dirCount; i += 1) { let dirName = unzipped.str().replace(/\\/g, '/'); dirs[dirName] = decodeFiles(unzipped); } return dirs; }
load() { const { x, z, world: { storage }, } = this; const { needsPropagation, voxels, } = JSON.parse(fs.readFileSync(path.join(storage, `${x}_${z}.json`))); this.needsPropagation = needsPropagation; this.needsPersistence = false; this.voxels = zlib.inflateSync(Buffer.from(voxels, 'base64')); this.generateHeightmap(); }
d: { token: client.internals.token, compress: isNode && !!Zlib.inflateSync, large_threshold: LARGE_THRESHOLD, presence: client.presence,