Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _doBackup = (): void => {
try {
const addressKeyring = address && keyring.getPair(address);
const json = addressKeyring && keyring.backupAccount(addressKeyring, password);
const blob = new Blob([JSON.stringify(json)], { type: 'application/json; charset=utf-8' });
FileSaver.saveAs(blob, `${address}.json`);
} catch (error) {
setBackupFailed(true);
console.error(error);
return;
}
onClose();
};
private accountsExport ({ address, password }: RequestAccountExport): ResponseAccountExport {
return { exportedJson: JSON.stringify(keyring.backupAccount(keyring.getPair(address), password)) };
}