Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.filter(item => item[1])
.map(([address]) => this.userList.find(user => user.address === address));
const stringifyUsers = JSON.stringify(users);
const saveUsers = !this.needPassword ?
stringifyUsers :
encryptSeed(stringifyUsers, this.password, 10000);
const saveData = {
encrypted: this.needPassword,
encryptionRounds: this.needPassword ? 10000 : undefined,
saveUsers
};
const dataToSaveInBytes = crypto.stringToBytes(JSON.stringify(saveData));
saveData.hashSum = crypto.base58Encode(crypto.sha256(dataToSaveInBytes));
const toSave = {
type: 'wavesBackup',
lastOpenVersion: this.settings.lastOpenVersion,
data: crypto.base64Encode(crypto.stringToBytes(JSON.stringify(saveData))),
checkSum: saveData.hashSum,
time: Date.now()
};
utils.downloadFile(`accountsBackup-${toSave.time}.json`, JSON.stringify(toSave, null, 4));
}