Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...events,
...newEvents.map(e => ({ ...e, block: { id: e.blockNumber } }))
],
e => e.id
)
debug(`Found ${events.length} events, ${newEvents.length} new`)
fromBlock = toBlock + 1
processing = false
while (queue.length) {
queue.pop()()
}
if (typeof window !== 'undefined') {
const compressed = LZString.compress(
JSON.stringify({
lastLookup,
events
})
)
window.localStorage[cacheStr] = compressed
// const hash = await post(config.ipfsRPC, { compressed }, true)
// console.log('IPFS Hash', hash)
}
}
set(key, val) {
// convert all values to string for proper compression
if (!_.isUndefined(val)) {
val = JSON.stringify(val);
console.log(`Setting key: ${key} with value: ${val}`);
localStorage.setItem(key, LZString.compress(val));
} else {
this.remove(key);
}
},
/**
this.pack = function(data) {
if (typeof data !== "string")
data = JSON.stringify(data);
let compressed = lz.compress(data);
let bytesPerChar = zaes.utils.detectBytesPerChar(compressed);
let compressedBytes = zaes.utils.stringToBytes(compressed, bytesPerChar);
let crypted = zaes.encrypt(compressedBytes, aesKey);
let total = [bytesPerChar].concat(crypted); // to decrypt then
return zaes.utils.bytesToString(total, 2);
};
revealAddress
}
};
const publicKey = get(state, 'account.publicKey');
if (publicKey) {
const username = get(state, 'account.username');
model[publicKey] = {
username,
contacts: state.contacts,
chats: state.chats,
};
}
const value = jsonpack.pack(model);
const compressed = LZString.compress(value);
localStorage.setItem(this.key, compressed);
}
compress(){
this.id = LZString.compress((JSON.stringify(this.id)))
this.lat = LZString.compress((JSON.stringify(this.lat)))
this.lon = LZString.compress((JSON.stringify(this.lon)))
this.speed = LZString.compress((JSON.stringify(this.speed)))
}
const bundle = {
items: database.items,
itemsIndex: database.itemsIndex.array
}
const itemKeys = []
for (let i = 0; i < bundle.itemsIndex.length; i++) {
const itemId = bundle.itemsIndex[i].itemId
const itemKey = await crypto.hmac.signString(this.keys.hmacKey, itemId)
itemKeys.push(itemKey)
}
const plaintextString = JSON.stringify(bundle)
const compressedString = LZString.compress(plaintextString)
const base64Bundle = await crypto.aesGcm.encryptString(database.dbKey, compressedString)
const action = 'Bundle'
const params = { dbId, seqNo: database.lastSeqNo, bundle: base64Bundle, keys: itemKeys }
this.request(action, params)
break
}
case 'ReceiveRequestForSeed': {
if (!this.keys.init) return
const requesterPublicKey = message.requesterPublicKey
this.sendSeed(requesterPublicKey)
break
y: y + dy,
z: z + dz
})
matrix.makeTranslation(wx, wy, wz)
mergedGeometry.merge(geometry, matrix, i)
materials.push([type, geo, face])
}
const finalGeometry = new THREE.BufferGeometry().fromGeometry(
mergedGeometry
)
const JSONGeo = finalGeometry.toJSON()
return [LZString.compress(JSON.stringify(JSONGeo)), materials]
}
compress() {
this.id = LZString.compress((JSON.stringify(this.id)));
this.lat = LZString.compress((JSON.stringify(this.lat)));
this.lon = LZString.compress((JSON.stringify(this.lon)));
this.speed = LZString.compress((JSON.stringify(this.speed)));
}
decompress() {