How to use the ethereumjs-wallet/thirdparty.fromEtherWallet function in ethereumjs-wallet

To help you get started, we’ve selected a few ethereumjs-wallet 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 brave / ethereum-remote-client / app / scripts / account-import-strategies / index.js View on Github external
'JSON File': (input, password) => {
      let wallet
      try {
        wallet = importers.fromEtherWallet(input, password)
      } catch (e) {
        console.log('Attempt to import as EtherWallet format failed, trying V3...')
      }

      if (!wallet) {
        wallet = Wallet.fromV3(input, password, true)
      }

      return walletToPrivateKey(wallet)
    },
  },
github ethfinex / community-gateway / src / services / keystoreService.js View on Github external
const MewV1Wallet = (keystore, password) => signWrapper(fromEtherWallet(keystore, password));
github MyCryptoHQ / MyCrypto / common / v2 / services / WalletService / non-deterministic / wallets.ts View on Github external
const MewV1Wallet = (keystore: string, password: string) =>
  signWrapper(fromEtherWallet(keystore, password));
github MetaMask / gaba / src / keyring / KeyringController.ts View on Github external
case 'privateKey':
				const [importedKey] = args;
				if (!importedKey) {
					throw new Error('Cannot import an empty key.');
				}
				const prefixed = ethUtil.addHexPrefix(importedKey);
				if (!ethUtil.isValidPrivate(ethUtil.toBuffer(prefixed))) {
					throw new Error('Cannot import invalid private key.');
				}
				privateKey = ethUtil.stripHexPrefix(prefixed);
				break;
			case 'json':
				let wallet;
				const [input, password] = args;
				try {
					wallet = importers.fromEtherWallet(input, password);
				} catch (e) {
					wallet = wallet || Wallet.fromV3(input, password, true);
				}
				privateKey = ethUtil.bufferToHex(wallet.getPrivateKey());
				break;
		}
		const newKeyring = await privates.get(this).keyring.addNewKeyring(KeyringTypes.simple, [privateKey]);
		const accounts = await newKeyring.getAccounts();
		const allAccounts = await privates.get(this).keyring.getAccounts();
		preferences.updateIdentities(allAccounts);
		preferences.update({ selectedAddress: accounts[0] });
		return this.fullUpdate();
	}
github MyCryptoHQ / MyCrypto / common / libs / wallet / non-deterministic / wallets.ts View on Github external
const MewV1Wallet = (keystore: string, password: string) =>
  signWrapper(fromEtherWallet(keystore, password));