Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 088b0a9

Browse files
authored
Merge pull request #78 from ethereumjs/update-deps
Update dependencies
2 parents 2d1c13b + 2a5f319 commit 088b0a9

File tree

5 files changed

+58
-58
lines changed

5 files changed

+58
-58
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
"dependencies": {
3535
"aes-js": "^3.1.1",
3636
"bs58check": "^2.1.2",
37-
"ethereumjs-util": "^5.2.0",
38-
"hdkey": "^1.0.0",
37+
"ethereumjs-util": "^6.0.0",
38+
"hdkey": "^1.1.0",
3939
"randombytes": "^2.0.6",
4040
"safe-buffer": "^5.1.2",
41-
"scrypt.js": "^0.2.0",
41+
"scrypt.js": "^0.3.0",
4242
"utf8": "^3.0.0",
4343
"uuid": "^3.3.2"
4444
},
@@ -48,7 +48,7 @@
4848
"coveralls": "^3.0.0",
4949
"istanbul": "^0.4.5",
5050
"mocha": "^5.2.0",
51-
"standard": "^11.0.0"
51+
"standard": "^12.0.0"
5252
},
5353
"standard": {
5454
"globals": [

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Wallet.prototype.toV3 = function (password, opts) {
142142

143143
var ciphertext = Buffer.concat([ cipher.update(this.privKey), cipher.final() ])
144144

145-
var mac = ethUtil.sha3(Buffer.concat([ derivedKey.slice(16, 32), Buffer.from(ciphertext, 'hex') ]))
145+
var mac = ethUtil.keccak256(Buffer.concat([ derivedKey.slice(16, 32), Buffer.from(ciphertext, 'hex') ]))
146146

147147
return {
148148
version: 3,
@@ -230,13 +230,13 @@ Wallet.fromV1 = function (input, password) {
230230

231231
var ciphertext = Buffer.from(json.Crypto.CipherText, 'hex')
232232

233-
var mac = ethUtil.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
233+
var mac = ethUtil.keccak256(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
234234

235235
if (mac.toString('hex') !== json.Crypto.MAC) {
236236
throw new Error('Key derivation failed - possibly wrong passphrase')
237237
}
238238

239-
var decipher = crypto.createDecipheriv('aes-128-cbc', ethUtil.sha3(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'))
239+
var decipher = crypto.createDecipheriv('aes-128-cbc', ethUtil.keccak256(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'))
240240
var seed = decipherBuffer(decipher, ciphertext)
241241

242242
return new Wallet(seed)
@@ -271,7 +271,7 @@ Wallet.fromV3 = function (input, password, nonStrict) {
271271

272272
var ciphertext = Buffer.from(json.crypto.ciphertext, 'hex')
273273

274-
var mac = ethUtil.sha3(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
274+
var mac = ethUtil.keccak256(Buffer.concat([ derivedKey.slice(16, 32), ciphertext ]))
275275
if (mac.toString('hex') !== json.crypto.mac) {
276276
throw new Error('Key derivation failed - possibly wrong passphrase')
277277
}
@@ -301,7 +301,7 @@ Wallet.fromEthSale = function (input, password) {
301301
var decipher = crypto.createDecipheriv('aes-128-cbc', derivedKey, encseed.slice(0, 16))
302302
var seed = decipherBuffer(decipher, encseed.slice(16))
303303

304-
var wallet = new Wallet(ethUtil.sha3(seed))
304+
var wallet = new Wallet(ethUtil.keccak256(seed))
305305
if (wallet.getAddress().toString('hex') !== json.ethaddr) {
306306
throw new Error('Decoded key mismatch - possibly wrong passphrase')
307307
}

src/test/hdkey.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,60 +16,60 @@ describe('.fromMasterSeed()', function () {
1616

1717
describe('.privateExtendedKey()', function () {
1818
it('should work', function () {
19-
assert.equal(fixturehd.privateExtendedKey(), 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
19+
assert.strictEqual(fixturehd.privateExtendedKey(), 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
2020
})
2121
})
2222

2323
describe('.publicExtendedKey()', function () {
2424
it('should work', function () {
25-
assert.equal(fixturehd.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
25+
assert.strictEqual(fixturehd.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
2626
})
2727
})
2828

2929
describe('.fromExtendedKey()', function () {
3030
it('should work with public', function () {
3131
var hdnode = HDKey.fromExtendedKey('xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
32-
assert.equal(hdnode.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
32+
assert.strictEqual(hdnode.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
3333
assert.throws(function () {
3434
hdnode.privateExtendedKey()
3535
}, /^Error: This is a public key only wallet$/)
3636
})
3737
it('should work with private', function () {
3838
var hdnode = HDKey.fromExtendedKey('xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
39-
assert.equal(hdnode.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
40-
assert.equal(hdnode.privateExtendedKey(), 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
39+
assert.strictEqual(hdnode.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
40+
assert.strictEqual(hdnode.privateExtendedKey(), 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
4141
})
4242
})
4343

4444
describe('.deriveChild()', function () {
4545
it('should work', function () {
4646
var hdnode = fixturehd.deriveChild(1)
47-
assert.equal(hdnode.privateExtendedKey(), 'xprv9vYSvrg3eR5FaKbQE4Ao2vHdyvfFL27aWMyH6X818mKWMsqqQZAN6HmRqYDGDPLArzaqbLExRsxFwtx2B2X2QKkC9uoKsiBNi22tLPKZHNS')
47+
assert.strictEqual(hdnode.privateExtendedKey(), 'xprv9vYSvrg3eR5FaKbQE4Ao2vHdyvfFL27aWMyH6X818mKWMsqqQZAN6HmRqYDGDPLArzaqbLExRsxFwtx2B2X2QKkC9uoKsiBNi22tLPKZHNS')
4848
})
4949
})
5050

5151
describe('.derivePath()', function () {
5252
it('should work with m', function () {
5353
var hdnode = fixturehd.derivePath('m')
54-
assert.equal(hdnode.privateExtendedKey(), 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
54+
assert.strictEqual(hdnode.privateExtendedKey(), 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')
5555
})
5656
it('should work with m/44\'/0\'/0/1', function () {
5757
var hdnode = fixturehd.derivePath('m/44\'/0\'/0/1')
58-
assert.equal(hdnode.privateExtendedKey(), 'xprvA1ErCzsuXhpB8iDTsbmgpkA2P8ggu97hMZbAXTZCdGYeaUrDhyR8fEw47BNEgLExsWCVzFYuGyeDZJLiFJ9kwBzGojQ6NB718tjVJrVBSrG')
58+
assert.strictEqual(hdnode.privateExtendedKey(), 'xprvA1ErCzsuXhpB8iDTsbmgpkA2P8ggu97hMZbAXTZCdGYeaUrDhyR8fEw47BNEgLExsWCVzFYuGyeDZJLiFJ9kwBzGojQ6NB718tjVJrVBSrG')
5959
})
6060
})
6161

6262
describe('.getWallet()', function () {
6363
it('should work', function () {
64-
assert.equal(fixturehd.getWallet().getPrivateKeyString(), '0x26cc9417b89cd77c4acdbe2e3cd286070a015d8e380f9cd1244ae103b7d89d81')
65-
assert.equal(fixturehd.getWallet().getPublicKeyString(),
64+
assert.strictEqual(fixturehd.getWallet().getPrivateKeyString(), '0x26cc9417b89cd77c4acdbe2e3cd286070a015d8e380f9cd1244ae103b7d89d81')
65+
assert.strictEqual(fixturehd.getWallet().getPublicKeyString(),
6666
'0x0639797f6cc72aea0f3d309730844a9e67d9f1866e55845c5f7e0ab48402973defa5cb69df462bcc6d73c31e1c663c225650e80ef14a507b203f2a12aea55bc1')
6767
})
6868
it('should work with public nodes', function () {
6969
var hdnode = HDKey.fromExtendedKey('xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
7070
assert.throws(function () {
7171
hdnode.getWallet().getPrivateKeyString()
7272
}, /^Error: This is a public key only wallet$/)
73-
assert.equal(hdnode.getWallet().getPublicKeyString(), '0x0639797f6cc72aea0f3d309730844a9e67d9f1866e55845c5f7e0ab48402973defa5cb69df462bcc6d73c31e1c663c225650e80ef14a507b203f2a12aea55bc1')
73+
assert.strictEqual(hdnode.getWallet().getPublicKeyString(), '0x0639797f6cc72aea0f3d309730844a9e67d9f1866e55845c5f7e0ab48402973defa5cb69df462bcc6d73c31e1c663c225650e80ef14a507b203f2a12aea55bc1')
7474
})
7575
})

0 commit comments

Comments
 (0)