How to use the ethereumjs-wallet.fromV3 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 go-faast / faast-web / src / services / Wallet / lib / Ethereum / EthereumWalletKeystore.ts View on Github external
getDecryptedKeystore(password?: string): EthereumjsWallet {
    if (this.keystore instanceof EthereumjsWallet) {
      return this.keystore
    }
    if (isUndefined(password)) {
      password = window.prompt(`Enter password for Ethereum account ${this.getAddress()}`)
    }
    if (!isString(password)) {
      throw new Error(`Invalid password of type ${typeof password}`)
    }
    return EthereumjsWallet.fromV3(this.keystore, password, true)
  }
github ethfinex / community-gateway / src / services / keystoreService.js View on Github external
const UtcWallet = (keystore, password) => fromV3(keystore, password, true);
github merklejerk / send-tokens / src / lib.js View on Github external
function fromKeystore(keystore, pw) {
	if (!pw)
		throw new Error('Keystore requires password.');
	if (_.isObject(keystore))
		keystore = JSON.stringify(keystore);
	const wallet = ethwallet.fromV3(keystore, pw, true);
	return ethjs.bufferToHex(wallet.getPrivateKey());
}
github ETCDEVTeam / emerald-js / src / wallet.js View on Github external
static fromV3(input, password) {
      return Wallet.fromV3(input, password);
    }
github MetaMask / gaba / src / keyring / KeyringController.ts View on Github external
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 PolymathNetwork / polymath-core-deprecated / truffle.js View on Github external
require('babel-register');
require('babel-polyfill');
const WalletProvider = require("truffle-wallet-provider");
const keystore = require('fs').readFileSync('./UTC--2018-01-26T17-50-04Z--074bf411-7666-c662-f1a0-d6a93f5d8719').toString();
const pass = require('fs').readFileSync('./password1.txt').toString();
const wallet = require('ethereumjs-wallet').fromV3(keystore, pass);

const config = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      gas: 15e6,
      gasPrice: 0x01,
      network_id: '*',
    },
    ropsten: {
      provider: new WalletProvider(wallet, "https://ropsten.infura.io/"),
      network_id: 3,
      gas: 4.5e6,
      gasPrice: 0x50,
    },
github LoopringSecondary / circulr / src / ethereum / keystore.js View on Github external
export function decryptUtcKeystoreToPkey (keystore, password)
{
    return fromV3(keystore, password, true).getPrivateKey();
}
github MyCryptoHQ / MyCrypto / common / containers / Tabs / RestoreKeystore / components / KeystoreDetails.tsx View on Github external
private runtimeKeystoreCheck(): boolean {
    const { wallet, password, secretKey } = this.state;
    if (wallet) {
      const keystore = wallet.toV3(password, { n: N_FACTOR });
      const backToWallet = fromV3(keystore, password, true);
      if (stripHexPrefix(backToWallet.getPrivateKeyString()) === secretKey) {
        return true;
      }
    }
    return false;
  }