Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ethereumjs-wallet

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereumjs-wallet - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

dist.browser/hdkey.d.ts

42

dist/hdkey.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("./index");
var hdkey_1 = require("ethereum-cryptography/hdkey");
var EthereumHDKey = /** @class */ (function () {
function EthereumHDKey(_hdkey) {
const index_1 = __importDefault(require("./index"));
const hdkey_1 = require("ethereum-cryptography/hdkey");
class EthereumHDKey {
constructor(_hdkey) {
this._hdkey = _hdkey;

@@ -15,15 +18,15 @@ }

*/
EthereumHDKey.fromMasterSeed = function (seedBuffer) {
static fromMasterSeed(seedBuffer) {
return new EthereumHDKey(hdkey_1.HDKey.fromMasterSeed(seedBuffer));
};
}
/**
* Create an instance based on a BIP32 extended private or public key.
*/
EthereumHDKey.fromExtendedKey = function (base58Key) {
static fromExtendedKey(base58Key) {
return new EthereumHDKey(hdkey_1.HDKey.fromExtendedKey(base58Key));
};
}
/**
* Returns a BIP32 extended private key (xprv)
*/
EthereumHDKey.prototype.privateExtendedKey = function () {
privateExtendedKey() {
if (!this._hdkey.privateExtendedKey) {

@@ -33,25 +36,25 @@ throw new Error('This is a public key only wallet');

return this._hdkey.privateExtendedKey;
};
}
/**
* Return a BIP32 extended public key (xpub)
*/
EthereumHDKey.prototype.publicExtendedKey = function () {
publicExtendedKey() {
return this._hdkey.publicExtendedKey;
};
}
/**
* Derives a node based on a path (e.g. m/44'/0'/0/1)
*/
EthereumHDKey.prototype.derivePath = function (path) {
derivePath(path) {
return new EthereumHDKey(this._hdkey.derive(path));
};
}
/**
* Derive a node based on a child index
*/
EthereumHDKey.prototype.deriveChild = function (index) {
deriveChild(index) {
return new EthereumHDKey(this._hdkey.deriveChild(index));
};
}
/**
* Return a `Wallet` instance as seen above
*/
EthereumHDKey.prototype.getWallet = function () {
getWallet() {
if (this._hdkey._privateKey) {

@@ -61,6 +64,5 @@ return index_1.default.fromPrivateKey(this._hdkey._privateKey);

return index_1.default.fromPublicKey(this._hdkey._publicKey, true);
};
return EthereumHDKey;
}());
}
}
exports.default = EthereumHDKey;
//# sourceMappingURL=hdkey.js.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var crypto = require("crypto");
var ethereumjs_util_1 = require("ethereumjs-util");
var scrypt_js_1 = require("scrypt-js");
exports.thirdparty = exports.hdkey = void 0;
const crypto = __importStar(require("crypto"));
const ethereumjs_util_1 = require("ethereumjs-util");
const scrypt_js_1 = require("scrypt-js");
var hdkey_1 = require("./hdkey");
Object.defineProperty(exports, "hdkey", { enumerable: true, get: function () { return hdkey_1.default; } });
Object.defineProperty(exports, "hdkey", { enumerable: true, get: function () { return __importDefault(hdkey_1).default; } });
var thirdparty_1 = require("./thirdparty");
Object.defineProperty(exports, "thirdparty", { enumerable: true, get: function () { return thirdparty_1.default; } });
var bs58check = require('bs58check');
var randomBytes = require('randombytes');
var uuidv4 = require('uuid/v4');
Object.defineProperty(exports, "thirdparty", { enumerable: true, get: function () { return __importDefault(thirdparty_1).default; } });
const bs58check = require('bs58check');
const randomBytes = require('randombytes');
const uuidv4 = require('uuid').v4;
function validateHexString(paramName, str, length) {

@@ -68,10 +44,10 @@ if (str.toLowerCase().startsWith('0x')) {

if (length % 2) {
throw new Error("Invalid length argument, must be an even number");
throw new Error(`Invalid length argument, must be an even number`);
}
if (typeof length === 'number' && str.length !== length) {
throw new Error("Invalid " + paramName + ", string must be " + length + " hex characters");
throw new Error(`Invalid ${paramName}, string must be ${length} hex characters`);
}
if (!/^([0-9a-f]{2})+$/i.test(str)) {
var howMany = typeof length === 'number' ? length : 'empty or a non-zero even number of';
throw new Error("Invalid " + paramName + ", string must be " + howMany + " hex characters");
const howMany = typeof length === 'number' ? length : 'empty or a non-zero even number of';
throw new Error(`Invalid ${paramName}, string must be ${howMany} hex characters`);
}

@@ -82,8 +58,8 @@ return str;

if (!Buffer.isBuffer(buff)) {
var howManyHex = typeof length === 'number' ? "" + length * 2 : 'empty or a non-zero even number of';
var howManyBytes = typeof length === 'number' ? " (" + length + " bytes)" : '';
throw new Error("Invalid " + paramName + ", must be a string (" + howManyHex + " hex characters) or buffer" + howManyBytes);
const howManyHex = typeof length === 'number' ? `${length * 2}` : 'empty or a non-zero even number of';
const howManyBytes = typeof length === 'number' ? ` (${length} bytes)` : '';
throw new Error(`Invalid ${paramName}, must be a string (${howManyHex} hex characters) or buffer${howManyBytes}`);
}
if (typeof length === 'number' && buff.length !== length) {
throw new Error("Invalid " + paramName + ", buffer must be " + length + " bytes");
throw new Error(`Invalid ${paramName}, buffer must be ${length} bytes`);
}

@@ -93,3 +69,3 @@ return buff;

function mergeToV3ParamsWithDefaults(params) {
var v3Defaults = {
const v3Defaults = {
cipher: 'aes-128-ctr',

@@ -127,3 +103,3 @@ kdf: 'scrypt',

}
return __assign(__assign({}, v3Defaults), params);
return Object.assign(Object.assign({}, v3Defaults), params);
}

@@ -148,5 +124,4 @@ function kdfParamsForPBKDF(opts) {

// wallet implementation
var Wallet = /** @class */ (function () {
function Wallet(privateKey, publicKey) {
if (publicKey === void 0) { publicKey = undefined; }
class Wallet {
constructor(privateKey, publicKey = undefined) {
this.privateKey = privateKey;

@@ -157,6 +132,6 @@ this.publicKey = publicKey;

}
if (privateKey && !ethereumjs_util_1.isValidPrivate(privateKey)) {
if (privateKey && !(0, ethereumjs_util_1.isValidPrivate)(privateKey)) {
throw new Error('Private key does not satisfy the curve requirements (ie. it is invalid)');
}
if (publicKey && !ethereumjs_util_1.isValidPublic(publicKey)) {
if (publicKey && !(0, ethereumjs_util_1.isValidPublic)(publicKey)) {
throw new Error('Invalid public key');

@@ -171,9 +146,8 @@ }

*/
Wallet.generate = function (icapDirect) {
if (icapDirect === void 0) { icapDirect = false; }
static generate(icapDirect = false) {
if (icapDirect) {
var max = new ethereumjs_util_1.BN('088f924eeceeda7fe92e1f5b0fffffffffffffff', 16);
const max = new ethereumjs_util_1.BN('088f924eeceeda7fe92e1f5b0fffffffffffffff', 16);
while (true) {
var privateKey = randomBytes(32);
if (new ethereumjs_util_1.BN(ethereumjs_util_1.privateToAddress(privateKey)).lte(max)) {
const privateKey = randomBytes(32);
if (new ethereumjs_util_1.BN((0, ethereumjs_util_1.privateToAddress)(privateKey)).lte(max)) {
return new Wallet(privateKey);

@@ -186,7 +160,7 @@ }

}
};
}
/**
* Create an instance where the address is valid against the supplied pattern (**this will be very slow**)
*/
Wallet.generateVanityAddress = function (pattern) {
static generateVanityAddress(pattern) {
if (!(pattern instanceof RegExp)) {

@@ -196,4 +170,4 @@ pattern = new RegExp(pattern);

while (true) {
var privateKey = randomBytes(32);
var address = ethereumjs_util_1.privateToAddress(privateKey);
const privateKey = randomBytes(32);
const address = (0, ethereumjs_util_1.privateToAddress)(privateKey);
if (pattern.test(address.toString('hex'))) {

@@ -203,3 +177,3 @@ return new Wallet(privateKey);

}
};
}
/**

@@ -211,34 +185,33 @@ * Create an instance based on a public key (certain methods will not be available)

*/
Wallet.fromPublicKey = function (publicKey, nonStrict) {
if (nonStrict === void 0) { nonStrict = false; }
static fromPublicKey(publicKey, nonStrict = false) {
if (nonStrict) {
publicKey = ethereumjs_util_1.importPublic(publicKey);
publicKey = (0, ethereumjs_util_1.importPublic)(publicKey);
}
return new Wallet(undefined, publicKey);
};
}
/**
* Create an instance based on a BIP32 extended public key (xpub)
*/
Wallet.fromExtendedPublicKey = function (extendedPublicKey) {
static fromExtendedPublicKey(extendedPublicKey) {
if (extendedPublicKey.slice(0, 4) !== 'xpub') {
throw new Error('Not an extended public key');
}
var publicKey = bs58check.decode(extendedPublicKey).slice(45);
const publicKey = bs58check.decode(extendedPublicKey).slice(45);
// Convert to an Ethereum public key
return Wallet.fromPublicKey(publicKey, true);
};
}
/**
* Create an instance based on a raw private key
*/
Wallet.fromPrivateKey = function (privateKey) {
static fromPrivateKey(privateKey) {
return new Wallet(privateKey);
};
}
/**
* Create an instance based on a BIP32 extended private key (xprv)
*/
Wallet.fromExtendedPrivateKey = function (extendedPrivateKey) {
static fromExtendedPrivateKey(extendedPrivateKey) {
if (extendedPrivateKey.slice(0, 4) !== 'xprv') {
throw new Error('Not an extended private key');
}
var tmp = bs58check.decode(extendedPrivateKey);
const tmp = bs58check.decode(extendedPrivateKey);
if (tmp[45] !== 0) {

@@ -248,3 +221,3 @@ throw new Error('Invalid extended private key');

return Wallet.fromPrivateKey(tmp.slice(46));
};
}
/**

@@ -256,31 +229,21 @@ * Import a wallet (Version 1 of the Ethereum wallet format).

*/
Wallet.fromV1 = function (input, password) {
return __awaiter(this, void 0, void 0, function () {
var json, kdfparams, derivedKey, ciphertext, mac, decipher, seed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
json = typeof input === 'object' ? input : JSON.parse(input);
if (json.Version !== '1') {
throw new Error('Not a V1 Wallet');
}
if (json.Crypto.KeyHeader.Kdf !== 'scrypt') {
throw new Error('Unsupported key derivation scheme');
}
kdfparams = json.Crypto.KeyHeader.KdfParams;
return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password), Buffer.from(json.Crypto.Salt, 'hex'), kdfparams.N, kdfparams.R, kdfparams.P, kdfparams.DkLen)];
case 1:
derivedKey = _a.sent();
ciphertext = Buffer.from(json.Crypto.CipherText, 'hex');
mac = ethereumjs_util_1.keccak256(Buffer.concat([derivedKey.slice(16, 32), ciphertext]));
if (mac.toString('hex') !== json.Crypto.MAC) {
throw new Error('Key derivation failed - possibly wrong passphrase');
}
decipher = crypto.createDecipheriv('aes-128-cbc', ethereumjs_util_1.keccak256(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'));
seed = runCipherBuffer(decipher, ciphertext);
return [2 /*return*/, new Wallet(seed)];
}
});
});
};
static async fromV1(input, password) {
const json = typeof input === 'object' ? input : JSON.parse(input);
if (json.Version !== '1') {
throw new Error('Not a V1 Wallet');
}
if (json.Crypto.KeyHeader.Kdf !== 'scrypt') {
throw new Error('Unsupported key derivation scheme');
}
const kdfparams = json.Crypto.KeyHeader.KdfParams;
const derivedKey = await (0, scrypt_js_1.scrypt)(Buffer.from(password), Buffer.from(json.Crypto.Salt, 'hex'), kdfparams.N, kdfparams.R, kdfparams.P, kdfparams.DkLen);
const ciphertext = Buffer.from(json.Crypto.CipherText, 'hex');
const mac = (0, ethereumjs_util_1.keccak256)(Buffer.concat([derivedKey.slice(16, 32), ciphertext]));
if (mac.toString('hex') !== json.Crypto.MAC) {
throw new Error('Key derivation failed - possibly wrong passphrase');
}
const decipher = crypto.createDecipheriv('aes-128-cbc', (0, ethereumjs_util_1.keccak256)(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'));
const seed = runCipherBuffer(decipher, ciphertext);
return new Wallet(seed);
}
/**

@@ -292,45 +255,32 @@ * Import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps.

*/
Wallet.fromV3 = function (input, password, nonStrict) {
if (nonStrict === void 0) { nonStrict = false; }
return __awaiter(this, void 0, void 0, function () {
var json, derivedKey, kdfparams, ciphertext, mac, decipher, seed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
json = typeof input === 'object' ? input : JSON.parse(nonStrict ? input.toLowerCase() : input);
if (json.version !== 3) {
throw new Error('Not a V3 wallet');
}
if (!(json.crypto.kdf === 'scrypt')) return [3 /*break*/, 2];
kdfparams = json.crypto.kdfparams;
return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen)];
case 1:
// FIXME: support progress reporting callback
derivedKey = _a.sent();
return [3 /*break*/, 3];
case 2:
if (json.crypto.kdf === 'pbkdf2') {
kdfparams = json.crypto.kdfparams;
if (kdfparams.prf !== 'hmac-sha256') {
throw new Error('Unsupported parameters to PBKDF2');
}
derivedKey = crypto.pbkdf2Sync(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256');
}
else {
throw new Error('Unsupported key derivation scheme');
}
_a.label = 3;
case 3:
ciphertext = Buffer.from(json.crypto.ciphertext, 'hex');
mac = ethereumjs_util_1.keccak256(Buffer.concat([Buffer.from(derivedKey.slice(16, 32)), ciphertext]));
if (mac.toString('hex') !== json.crypto.mac) {
throw new Error('Key derivation failed - possibly wrong passphrase');
}
decipher = crypto.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), Buffer.from(json.crypto.cipherparams.iv, 'hex'));
seed = runCipherBuffer(decipher, ciphertext);
return [2 /*return*/, new Wallet(seed)];
}
});
});
};
static async fromV3(input, password, nonStrict = false) {
const json = typeof input === 'object' ? input : JSON.parse(nonStrict ? input.toLowerCase() : input);
if (json.version !== 3) {
throw new Error('Not a V3 wallet');
}
let derivedKey, kdfparams;
if (json.crypto.kdf === 'scrypt') {
kdfparams = json.crypto.kdfparams;
// FIXME: support progress reporting callback
derivedKey = await (0, scrypt_js_1.scrypt)(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
}
else if (json.crypto.kdf === 'pbkdf2') {
kdfparams = json.crypto.kdfparams;
if (kdfparams.prf !== 'hmac-sha256') {
throw new Error('Unsupported parameters to PBKDF2');
}
derivedKey = crypto.pbkdf2Sync(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256');
}
else {
throw new Error('Unsupported key derivation scheme');
}
const ciphertext = Buffer.from(json.crypto.ciphertext, 'hex');
const mac = (0, ethereumjs_util_1.keccak256)(Buffer.concat([Buffer.from(derivedKey.slice(16, 32)), ciphertext]));
if (mac.toString('hex') !== json.crypto.mac) {
throw new Error('Key derivation failed - possibly wrong passphrase');
}
const decipher = crypto.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), Buffer.from(json.crypto.cipherparams.iv, 'hex'));
const seed = runCipherBuffer(decipher, ciphertext);
return new Wallet(seed);
}
/*

@@ -344,13 +294,13 @@ * Import an Ethereum Pre Sale wallet.

*/
Wallet.fromEthSale = function (input, password) {
var json = typeof input === 'object' ? input : JSON.parse(input);
var encseed = Buffer.from(json.encseed, 'hex');
static fromEthSale(input, password) {
const json = typeof input === 'object' ? input : JSON.parse(input);
const encseed = Buffer.from(json.encseed, 'hex');
// key derivation
var derivedKey = crypto.pbkdf2Sync(password, password, 2000, 32, 'sha256').slice(0, 16);
const derivedKey = crypto.pbkdf2Sync(password, password, 2000, 32, 'sha256').slice(0, 16);
// seed decoding (IV is first 16 bytes)
// NOTE: crypto (derived from openssl) when used with aes-*-cbc will handle PKCS#7 padding internally
// see also http://stackoverflow.com/a/31614770/4964819
var decipher = crypto.createDecipheriv('aes-128-cbc', derivedKey, encseed.slice(0, 16));
var seed = runCipherBuffer(decipher, encseed.slice(16));
var wallet = new Wallet(ethereumjs_util_1.keccak256(seed));
const decipher = crypto.createDecipheriv('aes-128-cbc', derivedKey, encseed.slice(0, 16));
const seed = runCipherBuffer(decipher, encseed.slice(16));
const wallet = new Wallet((0, ethereumjs_util_1.keccak256)(seed));
if (wallet.getAddress().toString('hex') !== json.ethaddr) {

@@ -360,30 +310,22 @@ throw new Error('Decoded key mismatch - possibly wrong passphrase');

return wallet;
};
Object.defineProperty(Wallet.prototype, "pubKey", {
// private getters
/**
* Returns the wallet's public key.
*/
get: function () {
if (!keyExists(this.publicKey)) {
this.publicKey = ethereumjs_util_1.privateToPublic(this.privateKey);
}
return this.publicKey;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Wallet.prototype, "privKey", {
/**
* Returns the wallet's private key.
*/
get: function () {
if (!keyExists(this.privateKey)) {
throw new Error('This is a public key only wallet');
}
return this.privateKey;
},
enumerable: false,
configurable: true
});
}
// private getters
/**
* Returns the wallet's public key.
*/
get pubKey() {
if (!keyExists(this.publicKey)) {
this.publicKey = (0, ethereumjs_util_1.privateToPublic)(this.privateKey);
}
return this.publicKey;
}
/**
* Returns the wallet's private key.
*/
get privKey() {
if (!keyExists(this.privateKey)) {
throw new Error('This is a public key only wallet');
}
return this.privateKey;
}
// public instance methods

@@ -395,8 +337,8 @@ /**

// tslint:disable-next-line
Wallet.prototype.getPrivateKey = function () {
getPrivateKey() {
return this.privKey;
};
Wallet.prototype.getPrivateKeyString = function () {
return ethereumjs_util_1.bufferToHex(this.privKey);
};
}
getPrivateKeyString() {
return (0, ethereumjs_util_1.bufferToHex)(this.privKey);
}
/**

@@ -406,23 +348,23 @@ * Returns the wallet's public key.

// tslint:disable-next-line
Wallet.prototype.getPublicKey = function () {
getPublicKey() {
return this.pubKey;
};
}
/**
* Returns the wallet's public key as a "0x" prefixed hex string
*/
Wallet.prototype.getPublicKeyString = function () {
return ethereumjs_util_1.bufferToHex(this.getPublicKey());
};
getPublicKeyString() {
return (0, ethereumjs_util_1.bufferToHex)(this.getPublicKey());
}
/**
* Returns the wallet's address.
*/
Wallet.prototype.getAddress = function () {
return ethereumjs_util_1.publicToAddress(this.pubKey);
};
getAddress() {
return (0, ethereumjs_util_1.publicToAddress)(this.pubKey);
}
/**
* Returns the wallet's address as a "0x" prefixed hex string
*/
Wallet.prototype.getAddressString = function () {
return ethereumjs_util_1.bufferToHex(this.getAddress());
};
getAddressString() {
return (0, ethereumjs_util_1.bufferToHex)(this.getAddress());
}
/**

@@ -432,5 +374,5 @@ * Returns the wallet's private key as a "0x" prefixed hex string checksummed

*/
Wallet.prototype.getChecksumAddressString = function () {
return ethereumjs_util_1.toChecksumAddress(this.getAddressString());
};
getChecksumAddressString() {
return (0, ethereumjs_util_1.toChecksumAddress)(this.getAddressString());
}
/**

@@ -442,59 +384,47 @@ * Returns an Etherem Version 3 Keystore Format object representing the wallet

*/
Wallet.prototype.toV3 = function (password, opts) {
return __awaiter(this, void 0, void 0, function () {
var v3Params, kdfParams, derivedKey, _a, cipher, ciphertext, mac;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!keyExists(this.privateKey)) {
throw new Error('This is a public key only wallet');
}
v3Params = mergeToV3ParamsWithDefaults(opts);
_a = v3Params.kdf;
switch (_a) {
case "pbkdf2" /* PBKDF */: return [3 /*break*/, 1];
case "scrypt" /* Scrypt */: return [3 /*break*/, 2];
}
return [3 /*break*/, 4];
case 1:
kdfParams = kdfParamsForPBKDF(v3Params);
derivedKey = crypto.pbkdf2Sync(Buffer.from(password), kdfParams.salt, kdfParams.c, kdfParams.dklen, 'sha256');
return [3 /*break*/, 5];
case 2:
kdfParams = kdfParamsForScrypt(v3Params);
return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password), kdfParams.salt, kdfParams.n, kdfParams.r, kdfParams.p, kdfParams.dklen)];
case 3:
// FIXME: support progress reporting callback
derivedKey = _b.sent();
return [3 /*break*/, 5];
case 4: throw new Error('Unsupported kdf');
case 5:
cipher = crypto.createCipheriv(v3Params.cipher, derivedKey.slice(0, 16), v3Params.iv);
if (!cipher) {
throw new Error('Unsupported cipher');
}
ciphertext = runCipherBuffer(cipher, this.privKey);
mac = ethereumjs_util_1.keccak256(Buffer.concat([Buffer.from(derivedKey.slice(16, 32)), Buffer.from(ciphertext)]));
return [2 /*return*/, {
version: 3,
id: uuidv4({ random: v3Params.uuid }),
// @ts-ignore - the official V3 keystore spec omits the address key
address: this.getAddress().toString('hex'),
crypto: {
ciphertext: ciphertext.toString('hex'),
cipherparams: { iv: v3Params.iv.toString('hex') },
cipher: v3Params.cipher,
kdf: v3Params.kdf,
kdfparams: __assign(__assign({}, kdfParams), { salt: kdfParams.salt.toString('hex') }),
mac: mac.toString('hex'),
},
}];
}
});
});
};
async toV3(password, opts) {
if (!keyExists(this.privateKey)) {
throw new Error('This is a public key only wallet');
}
const v3Params = mergeToV3ParamsWithDefaults(opts);
let kdfParams;
let derivedKey;
switch (v3Params.kdf) {
case "pbkdf2" /* PBKDF */:
kdfParams = kdfParamsForPBKDF(v3Params);
derivedKey = crypto.pbkdf2Sync(Buffer.from(password), kdfParams.salt, kdfParams.c, kdfParams.dklen, 'sha256');
break;
case "scrypt" /* Scrypt */:
kdfParams = kdfParamsForScrypt(v3Params);
// FIXME: support progress reporting callback
derivedKey = await (0, scrypt_js_1.scrypt)(Buffer.from(password), kdfParams.salt, kdfParams.n, kdfParams.r, kdfParams.p, kdfParams.dklen);
break;
default:
throw new Error('Unsupported kdf');
}
const cipher = crypto.createCipheriv(v3Params.cipher, derivedKey.slice(0, 16), v3Params.iv);
if (!cipher) {
throw new Error('Unsupported cipher');
}
const ciphertext = runCipherBuffer(cipher, this.privKey);
const mac = (0, ethereumjs_util_1.keccak256)(Buffer.concat([Buffer.from(derivedKey.slice(16, 32)), Buffer.from(ciphertext)]));
return {
version: 3,
id: uuidv4({ random: v3Params.uuid }),
// @ts-ignore - the official V3 keystore spec omits the address key
address: this.getAddress().toString('hex'),
crypto: {
ciphertext: ciphertext.toString('hex'),
cipherparams: { iv: v3Params.iv.toString('hex') },
cipher: v3Params.cipher,
kdf: v3Params.kdf,
kdfparams: Object.assign(Object.assign({}, kdfParams), { salt: kdfParams.salt.toString('hex') }),
mac: mac.toString('hex'),
},
};
}
/**
* Return the suggested filename for V3 keystores.
*/
Wallet.prototype.getV3Filename = function (timestamp) {
getV3Filename(timestamp) {
/*

@@ -511,20 +441,9 @@ * We want a timestamp like 2016-03-15T17-11-33.007598288Z. Date formatting

*/
var ts = timestamp ? new Date(timestamp) : new Date();
const ts = timestamp ? new Date(timestamp) : new Date();
return ['UTC--', ts.toJSON().replace(/:/g, '-'), '--', this.getAddress().toString('hex')].join('');
};
Wallet.prototype.toV3String = function (password, opts) {
return __awaiter(this, void 0, void 0, function () {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = (_a = JSON).stringify;
return [4 /*yield*/, this.toV3(password, opts)];
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
}
});
});
};
return Wallet;
}());
}
async toV3String(password, opts) {
return JSON.stringify(await this.toV3(password, opts));
}
}
exports.default = Wallet;

@@ -531,0 +450,0 @@ // helpers

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromQuorumWallet = exports.fromKryptoKit = exports.fromEtherCamp = exports.fromEtherWallet = void 0;
var crypto = require("crypto");
var ethereumjs_util_1 = require("ethereumjs-util");
var scrypt_js_1 = require("scrypt-js");
var index_1 = require("./index");
var utf8 = require('utf8');
var aesjs = require('aes-js');
const crypto = __importStar(require("crypto"));
const ethereumjs_util_1 = require("ethereumjs-util");
const scrypt_js_1 = require("scrypt-js");
const index_1 = __importDefault(require("./index"));
const utf8 = require('utf8');
const aesjs = require('aes-js');
function runCipherBuffer(cipher, data) {
return Buffer.concat([cipher.update(data), cipher.final()]);
}
var evpKdfDefaults = {
const evpKdfDefaults = {
count: 1,

@@ -78,6 +64,6 @@ keysize: 16,

function evp_kdf(data, salt, opts) {
var params = mergeEvpKdfOptsWithDefaults(opts);
const params = mergeEvpKdfOptsWithDefaults(opts);
// A single EVP iteration, returns `D_i`, where block equlas to `D_(i-1)`
function iter(block) {
var hash = crypto.createHash(params.digest);
let hash = crypto.createHash(params.digest);
hash.update(block);

@@ -87,3 +73,3 @@ hash.update(data);

block = hash.digest();
for (var i_1 = 1, len = params.count; i_1 < len; i_1++) {
for (let i = 1, len = params.count; i < len; i++) {
hash = crypto.createHash(params.digest);

@@ -95,4 +81,4 @@ hash.update(block);

}
var ret = [];
var i = 0;
const ret = [];
let i = 0;
while (Buffer.concat(ret).length < params.keysize + params.ivsize) {

@@ -102,3 +88,3 @@ ret[i] = iter(i === 0 ? Buffer.alloc(0) : ret[i - 1]);

}
var tmp = Buffer.concat(ret);
const tmp = Buffer.concat(ret);
return {

@@ -111,3 +97,3 @@ key: tmp.slice(0, params.keysize),

function decodeCryptojsSalt(input) {
var ciphertext = Buffer.from(input, 'base64');
const ciphertext = Buffer.from(input, 'base64');
if (ciphertext.slice(0, 8).toString() === 'Salted__') {

@@ -119,3 +105,3 @@ return {

}
return { ciphertext: ciphertext };
return { ciphertext };
}

@@ -128,4 +114,4 @@ /*

function fromEtherWallet(input, password) {
var json = typeof input === 'object' ? input : JSON.parse(input);
var privateKey;
const json = typeof input === 'object' ? input : JSON.parse(input);
let privateKey;
if (!json.locked) {

@@ -146,5 +132,5 @@ if (json.private.length !== 64) {

// of the hash of the address appended
var hash = json.encrypted ? json.private.slice(0, 128) : json.private;
const hash = json.encrypted ? json.private.slice(0, 128) : json.private;
// decode openssl ciphertext + salt encoding
var cipher = decodeCryptojsSalt(hash);
const cipher = decodeCryptojsSalt(hash);
if (!cipher.salt) {

@@ -154,4 +140,4 @@ throw new Error('Unsupported EtherWallet key format');

// derive key/iv using OpenSSL EVP as implemented in CryptoJS
var evp = evp_kdf(Buffer.from(password), cipher.salt, { keysize: 32, ivsize: 16 });
var decipher = crypto.createDecipheriv('aes-256-cbc', evp.key, evp.iv);
const evp = evp_kdf(Buffer.from(password), cipher.salt, { keysize: 32, ivsize: 16 });
const decipher = crypto.createDecipheriv('aes-256-cbc', evp.key, evp.iv);
privateKey = runCipherBuffer(decipher, Buffer.from(cipher.ciphertext));

@@ -161,3 +147,3 @@ // NOTE: yes, they've run it through UTF8

}
var wallet = new index_1.default(privateKey);
const wallet = new index_1.default(privateKey);
if (wallet.getAddressString() !== json.address) {

@@ -173,3 +159,3 @@ throw new Error('Invalid private key or address');

function fromEtherCamp(passphrase) {
return new index_1.default(ethereumjs_util_1.keccak256(Buffer.from(passphrase)));
return new index_1.default((0, ethereumjs_util_1.keccak256)(Buffer.from(passphrase)));
}

@@ -180,84 +166,72 @@ exports.fromEtherCamp = fromEtherCamp;

*/
function fromKryptoKit(entropy, password) {
return __awaiter(this, void 0, void 0, function () {
function kryptoKitBrokenScryptSeed(buf) {
// js-scrypt calls `Buffer.from(String(salt), 'utf8')` on the seed even though it is a buffer
//
// The `buffer`` implementation used does the below transformation (doesn't matches the current version):
// https://github.com/feross/buffer/blob/67c61181b938b17d10dbfc0a545f713b8bd59de8/index.js
function decodeUtf8Char(str) {
try {
return decodeURIComponent(str);
}
catch (err) {
return String.fromCharCode(0xfffd); // UTF 8 invalid char
}
async function fromKryptoKit(entropy, password) {
function kryptoKitBrokenScryptSeed(buf) {
// js-scrypt calls `Buffer.from(String(salt), 'utf8')` on the seed even though it is a buffer
//
// The `buffer`` implementation used does the below transformation (doesn't matches the current version):
// https://github.com/feross/buffer/blob/67c61181b938b17d10dbfc0a545f713b8bd59de8/index.js
function decodeUtf8Char(str) {
try {
return decodeURIComponent(str);
}
var res = '', tmp = '';
for (var i = 0; i < buf.length; i++) {
if (buf[i] <= 0x7f) {
res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]);
tmp = '';
}
else {
tmp += '%' + buf[i].toString(16);
}
catch (err) {
return String.fromCharCode(0xfffd); // UTF 8 invalid char
}
return Buffer.from(res + decodeUtf8Char(tmp));
}
var type, privateKey, encryptedSeed, checksum, salt, aesKey, decipher;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (entropy[0] === '#') {
entropy = entropy.slice(1);
}
type = entropy[0];
entropy = entropy.slice(1);
if (!(type === 'd')) return [3 /*break*/, 1];
privateKey = ethereumjs_util_1.sha256(ethereumjs_util_1.toBuffer(entropy));
return [3 /*break*/, 4];
case 1:
if (!(type === 'q')) return [3 /*break*/, 3];
if (typeof password !== 'string') {
throw new Error('Password required');
}
encryptedSeed = ethereumjs_util_1.sha256(Buffer.from(entropy.slice(0, 30)));
checksum = entropy.slice(30, 46);
salt = kryptoKitBrokenScryptSeed(encryptedSeed);
return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password, 'utf8'), salt, 16384, 8, 1, 32)
/* FIXME: try to use `crypto` instead of `aesjs`
// NOTE: ECB doesn't use the IV, so it can be anything
var decipher = crypto.createDecipheriv("aes-256-ecb", aesKey, Buffer.from(0))
// FIXME: this is a clear abuse, but seems to match how ECB in aesjs works
privKey = Buffer.concat([
decipher.update(encryptedSeed).slice(0, 16),
decipher.update(encryptedSeed).slice(0, 16),
])
*/
];
case 2:
aesKey = _a.sent();
decipher = new aesjs.ModeOfOperation.ecb(aesKey);
/* decrypt returns an Uint8Array, perhaps there is a better way to concatenate */
privateKey = Buffer.concat([
Buffer.from(decipher.decrypt(encryptedSeed.slice(0, 16))),
Buffer.from(decipher.decrypt(encryptedSeed.slice(16, 32))),
]);
if (checksum.length > 0) {
if (checksum !==
ethereumjs_util_1.sha256(ethereumjs_util_1.sha256(privateKey))
.slice(0, 8)
.toString('hex')) {
throw new Error('Failed to decrypt input - possibly invalid passphrase');
}
}
return [3 /*break*/, 4];
case 3: throw new Error('Unsupported or invalid entropy type');
case 4: return [2 /*return*/, new index_1.default(privateKey)];
let res = '', tmp = '';
for (let i = 0; i < buf.length; i++) {
if (buf[i] <= 0x7f) {
res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]);
tmp = '';
}
});
});
else {
tmp += '%' + buf[i].toString(16);
}
}
return Buffer.from(res + decodeUtf8Char(tmp));
}
if (entropy[0] === '#') {
entropy = entropy.slice(1);
}
const type = entropy[0];
entropy = entropy.slice(1);
let privateKey;
if (type === 'd') {
privateKey = (0, ethereumjs_util_1.sha256)((0, ethereumjs_util_1.toBuffer)(entropy));
}
else if (type === 'q') {
if (typeof password !== 'string') {
throw new Error('Password required');
}
const encryptedSeed = (0, ethereumjs_util_1.sha256)(Buffer.from(entropy.slice(0, 30)));
const checksum = entropy.slice(30, 46);
const salt = kryptoKitBrokenScryptSeed(encryptedSeed);
const aesKey = await (0, scrypt_js_1.scrypt)(Buffer.from(password, 'utf8'), salt, 16384, 8, 1, 32);
/* FIXME: try to use `crypto` instead of `aesjs`
// NOTE: ECB doesn't use the IV, so it can be anything
var decipher = crypto.createDecipheriv("aes-256-ecb", aesKey, Buffer.from(0))
// FIXME: this is a clear abuse, but seems to match how ECB in aesjs works
privKey = Buffer.concat([
decipher.update(encryptedSeed).slice(0, 16),
decipher.update(encryptedSeed).slice(0, 16),
])
*/
const decipher = new aesjs.ModeOfOperation.ecb(aesKey);
/* decrypt returns an Uint8Array, perhaps there is a better way to concatenate */
privateKey = Buffer.concat([
Buffer.from(decipher.decrypt(encryptedSeed.slice(0, 16))),
Buffer.from(decipher.decrypt(encryptedSeed.slice(16, 32))),
]);
if (checksum.length > 0) {
if (checksum !== (0, ethereumjs_util_1.sha256)((0, ethereumjs_util_1.sha256)(privateKey)).slice(0, 8).toString('hex')) {
throw new Error('Failed to decrypt input - possibly invalid passphrase');
}
}
}
else {
throw new Error('Unsupported or invalid entropy type');
}
return new index_1.default(privateKey);
}

@@ -275,14 +249,14 @@ exports.fromKryptoKit = fromKryptoKit;

}
var merged = passphrase + userid;
var seed = crypto.pbkdf2Sync(merged, merged, 2000, 32, 'sha256');
const merged = passphrase + userid;
const seed = crypto.pbkdf2Sync(merged, merged, 2000, 32, 'sha256');
return new index_1.default(seed);
}
exports.fromQuorumWallet = fromQuorumWallet;
var Thirdparty = {
fromEtherWallet: fromEtherWallet,
fromEtherCamp: fromEtherCamp,
fromKryptoKit: fromKryptoKit,
fromQuorumWallet: fromQuorumWallet,
const Thirdparty = {
fromEtherWallet,
fromEtherCamp,
fromKryptoKit,
fromQuorumWallet,
};
exports.default = Thirdparty;
//# sourceMappingURL=thirdparty.js.map
{
"name": "ethereumjs-wallet",
"version": "1.0.1",
"version": "1.0.2",
"description": "Utilities for handling Ethereum keys",
"main": "dist/index.js",
"types": "./dist/index.d.ts",
"types": "dist/index.d.ts",
"browser": "dist.browser/index.js",
"files": [
"dist"
"src",
"dist",
"dist.browser"
],
"scripts": {
"build": "ethereumjs-config-build",
"prepublishOnly": "",
"build": "tsc -p ./tsconfig.prod.json && tsc -p tsconfig.browser.json",
"prepublishOnly": "npm run lint && npm run build && npm run test",
"docs:build": "typedoc --out docs --mode file --readme none --theme markdown --mdEngine github --excludeNotExported src",
"coverage": "ethereumjs-config-coverage",
"format": "ethereumjs-config-format",
"format:fix": "ethereumjs-config-format-fix",
"coverage": "npm run build && nyc --reporter=lcov npm run test:unit",
"tsc": "tsc -p ./tsconfig.prod.json --noEmit",
"lint": "ethereumjs-config-lint",
"lint:fix": "ethereumjs-config-lint-fix",
"test": "npm run build && nyc --reporter=lcov mocha --require ts-node/register --require source-map-support/register ./test/**/*.ts",
"test:browser": "karma start karma.conf.js",
"tsc": "ethereumjs-config-tsc",
"tslint": "ethereumjs-config-tslint",
"tslint:fix": "ethereumjs-config-tslint-fix"
"test": "npm run lint && npm run build && npm run test:unit && npm run test:browser",
"test:unit": "mocha --require ts-node/register ./test/**/*.ts",
"test:browser": "karma start karma.conf.js"
},

@@ -46,39 +46,35 @@ "husky": {

"dependencies": {
"aes-js": "^3.1.1",
"aes-js": "^3.1.2",
"bs58check": "^2.1.2",
"ethereum-cryptography": "^0.1.3",
"ethereumjs-util": "^7.0.2",
"randombytes": "^2.0.6",
"ethereumjs-util": "^7.1.2",
"randombytes": "^2.1.0",
"scrypt-js": "^3.0.1",
"utf8": "^3.0.0",
"uuid": "^3.3.2"
"uuid": "^8.3.2"
},
"devDependencies": {
"@ethereumjs/config-nyc": "^1.1.1",
"@ethereumjs/config-prettier": "^1.1.1",
"@ethereumjs/config-tsc": "^1.1.1",
"@ethereumjs/config-tslint": "^1.1.1",
"@types/bn.js": "^4.11.5",
"@ethereumjs/eslint-config-defaults": "^2.0.0",
"@ethereumjs/config-coverage": "^2.0.0",
"@ethereumjs/config-typescript": "^2.0.0",
"@types/bn.js": "^5.1.0",
"@types/lodash.zip": "^4.2.6",
"@types/mocha": "^5.2.7",
"@types/mocha": "^9.0.0",
"@types/node": "^12.0.10",
"ethers": "^4.0.33",
"husky": "^2.1.0",
"karma": "^5.0.2",
"karma-chrome-launcher": "^2.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^2.0.0",
"karma-typescript": "^5.0.2",
"husky": "^4.2.5",
"karma": "^6.3.4",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^2.1.1",
"karma-mocha": "^2.0.1",
"karma-typescript": "^5.5.2",
"lodash.zip": "^4.2.0",
"mocha": "^7.1.2",
"nyc": "^15.0.1",
"prettier": "^1.15.3",
"source-map-support": "^0.5.12",
"ts-node": "^8.9.1",
"tslint": "^5.12.0",
"typedoc": "^0.14.2",
"typedoc-plugin-markdown": "^1.2.0",
"typescript": "^3.8.3",
"typestrict": "^1.0.2"
"mocha": "^9.1.2",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"ts-node": "^10.2.1",
"typedoc": "^0.22.5",
"typedoc-plugin-markdown": "^3.11.3",
"typescript": "^4.4.3"
}
}
# ethereumjs-wallet
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-wallet.svg)](https://www.npmjs.org/package/ethereumjs-wallet)
[![Actions Status](https://github.com/ethereumjs/ethereumjs-wallet/workflows/Build/badge.svg)](https://github.com/ethereumjs/ethereumjs-wallet/actions)
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-wallet.svg)](https://coveralls.io/r/ethereumjs/ethereumjs-wallet)
[![NPM Package][npm-badge]][npm-link]
[![Actions Status][actions-badge]][actions-link]
[![Coverage Status][coverage-badge]][coverage-link]
[![Discord][discord-badge]][discord-link]

@@ -12,3 +12,3 @@

- [ethereumjs-tx](https://github.com/ethereumjs/ethereumjs-tx) to sign transactions
- [@ethereumjs/tx](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/tx) to sign transactions
- [ethereumjs-icap](https://github.com/ethereumjs/ethereumjs-icap) to manipulate ICAP addresses

@@ -21,3 +21,3 @@ - [store.js](https://github.com/marcuswestin/store.js) to use browser storage

- work in a browser
- use a single, maintained version of crypto library (and that should be in line with `ethereumjs-util` and `ethereumjs-tx`)
- use a single, maintained version of crypto library (and that should be in line with [`ethereumjs-util`](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) and `@ethereumjs/tx`)
- support import/export between various wallet formats

@@ -40,3 +40,3 @@ - support BIP32 HD keys

```js
const { Wallet } = require('ethereumjs-wallet')
const Wallet = require('ethereumjs-wallet').default
```

@@ -47,3 +47,3 @@

```js
import { Wallet } from 'ethereumjs-wallet'
import Wallet from 'ethereumjs-wallet'
```

@@ -142,3 +142,9 @@

[actions-badge]: https://github.com/ethereumjs/ethereumjs-wallet/workflows/Build/badge.svg
[actions-link]: https://github.com/ethereumjs/ethereumjs-wallet/actions
[coverage-badge]: https://img.shields.io/coveralls/ethereumjs/ethereumjs-wallet.svg
[coverage-link]: https://coveralls.io/r/ethereumjs/ethereumjs-wallet
[discord-badge]: https://img.shields.io/static/v1?logo=discord&label=discord&message=Join&color=blue
[discord-link]: https://discord.gg/TNwARpR
[npm-badge]: https://img.shields.io/npm/v/ethereumjs-wallet.svg
[npm-link]: https://www.npmjs.org/package/ethereumjs-wallet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc