ethereumjs-wallet
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -25,2 +25,6 @@ const HDKey = require('hdkey') | ||
EthereumHDKey.prototype.privateExtendedKey = function () { | ||
// FIXME: change this according to the outcome of https://github.com/cryptocoinjs/hdkey/issues/7 | ||
if (!this._hdkey._privateKey) { | ||
throw new Error('Private key is not available') | ||
} | ||
return this._hdkey.privateExtendedKey | ||
@@ -27,0 +31,0 @@ } |
@@ -227,4 +227,2 @@ var ethUtil = require('ethereumjs-util') | ||
// FIXME: Remove PKCS#7 padding here? | ||
return new Wallet(seed) | ||
@@ -270,4 +268,2 @@ } | ||
// FIXME: Remove PKCS#7 padding here? | ||
return new Wallet(seed) | ||
@@ -290,7 +286,7 @@ } | ||
// 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 = decipherBuffer(decipher, encseed.slice(16)) | ||
// FIXME: Remove PKCS#7 padding here? | ||
var wallet = new Wallet(ethUtil.sha3(seed)) | ||
@@ -297,0 +293,0 @@ if (wallet.getAddress().toString('hex') !== json.ethaddr) { |
{ | ||
"name": "ethereumjs-wallet", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Utilities for handling Ethereum keys", | ||
"main": "index.js", | ||
"scripts": { | ||
"coverage": "istanbul cover _mocha", | ||
"coveralls": "npm run coverage && coveralls <coverage/lcov.info", | ||
"lint": "standard", | ||
"prepublish": "npm run lint && npm run test", | ||
"test": "mocha ./test/index.js && mocha ./test/hdkey.js" | ||
"test": "mocha ./test/**/*.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/axic/ethereumjs-wallet.git" | ||
"url": "https://github.com/ethereumjs/ethereumjs-wallet.git" | ||
}, | ||
@@ -23,5 +25,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/axic/ethereumjs-wallet/issues" | ||
"url": "https://github.com/ethereumjs/ethereumjs-wallet/issues" | ||
}, | ||
"homepage": "https://github.com/axic/ethereumjs-wallet", | ||
"homepage": "https://github.com/ethereumjs/ethereumjs-wallet", | ||
"dependencies": { | ||
@@ -38,2 +40,4 @@ "aes-js": "^0.2.3", | ||
"devDependencies": { | ||
"coveralls": "^2.11.4", | ||
"istanbul": "^0.4.1", | ||
"mocha": "^2.3.4", | ||
@@ -40,0 +44,0 @@ "standard": "^5.4.1" |
# ethereumjs-wallet | ||
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-wallet.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-wallet) | ||
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-wallet.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-wallet) | ||
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-wallet.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-wallet) | ||
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode | ||
A lightweight wallet implementation. At the moment it supports key creation and conversion between various formats. | ||
@@ -13,3 +18,3 @@ | ||
- work in a browser | ||
- use a single, maintained version of crypto library | ||
- use a single, maintained version of crypto library (and that should be in line with `ethereumjs-util` and `ethereumjs-tx`) | ||
- support import/export between various wallet formats | ||
@@ -28,5 +33,5 @@ - support BIP32 HD keys | ||
* `fromPrivateKey(input)` - create an instance based on a raw private key | ||
* `fromExtendedPrivateKey(input)` - create an instance based on a BIP32 xprv | ||
* `fromExtendedPrivateKey(input)` - create an instance based on a BIP32 extended private key (xprv) | ||
* `fromPublicKey(input, [nonStrict])` - create an instance based on a public key (certain methods will not be available) | ||
* `fromExtendedPublicKey(input)` - create an instance based on a BIP32 xpub | ||
* `fromExtendedPublicKey(input)` - create an instance based on a BIP32 extended public key (xpub) | ||
* `fromV1(input, password)` - import a wallet (Version 1 of the Ethereum wallet format) | ||
@@ -51,2 +56,4 @@ * `fromV3(input, password, [nonStrict])` - import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps. | ||
Note: `getPublicKey()` only returns uncompressed Ethereum-style public keys. | ||
## Thirdparty API | ||
@@ -80,4 +87,4 @@ | ||
* `privateExtendedKey()` - return a BIP32 extended private key | ||
* `publicExtendedKey()` - return a BIP32 extended private key | ||
* `privateExtendedKey()` - return a BIP32 extended private key (xprv) | ||
* `publicExtendedKey()` - return a BIP32 extended public key (xpub) | ||
* `derivePath(path)` - derive a node based on a path (e.g. m/44'/0'/0/1) | ||
@@ -84,0 +91,0 @@ * `deriveChild(index)` - derive a node based on a child index |
@@ -34,3 +34,3 @@ var assert = require('assert') | ||
hdnode.privateExtendedKey() | ||
}) | ||
}, /^Error: Private key is not available$/) | ||
}) | ||
@@ -72,5 +72,5 @@ it('should work with private', function () { | ||
hdnode.getWallet().getPrivateKeyString() | ||
}) | ||
}, /^Error: This is a public key only wallet$/) | ||
assert.equal(hdnode.getWallet().getPublicKeyString(), '0x0639797f6cc72aea0f3d309730844a9e67d9f1866e55845c5f7e0ab48402973defa5cb69df462bcc6d73c31e1c663c225650e80ef14a507b203f2a12aea55bc1') | ||
}) | ||
}) |
@@ -15,3 +15,3 @@ var assert = require('assert') | ||
Wallet.fromPrivateKey(new Buffer('001122', 'hex')) | ||
}) | ||
}, /^Error: Private key does not satisfy the curve requirements \(ie. it is invalid\)$/) | ||
}) | ||
@@ -65,3 +65,3 @@ }) | ||
Wallet.fromPublicKey(new Buffer('030639797f6cc72aea0f3d309730844a9e67d9f1866e55845c5f7e0ab48402973d', 'hex')) | ||
}) | ||
}, /^Error: Invalid public key$/) | ||
}) | ||
@@ -79,3 +79,3 @@ it('.fromPublicKey() should accept compressed keys in non-strict mode', function () { | ||
Wallet.fromPublicKey(pubKey).getPrivateKey() | ||
}) | ||
}, /^Error: This is a public key only wallet$/) | ||
}) | ||
@@ -85,3 +85,3 @@ it('.toV3() should fail', function () { | ||
Wallet.fromPublicKey(pubKey).toV3() | ||
}) | ||
}, /^Error: This is a public key only wallet$/) | ||
}) | ||
@@ -180,3 +180,3 @@ }) | ||
Wallet.fromV3(w, 'testpassword') | ||
}) | ||
}) // FIXME: check for assert message(s) | ||
}) | ||
@@ -183,0 +183,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44667
10
751
124
4