How to use the @polkadot/ui-keyring.backupAccount function in @polkadot/ui-keyring

To help you get started, we’ve selected a few @polkadot/ui-keyring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / apps / packages / app-accounts / src / modals / Backup.tsx View on Github external
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();
  };
github polkadot-js / extension / packages / extension / src / background / handlers / Extension.ts View on Github external
private accountsExport ({ address, password }: RequestAccountExport): ResponseAccountExport {
    return { exportedJson: JSON.stringify(keyring.backupAccount(keyring.getPair(address), password)) };
  }