This repository was archived by the owner on Oct 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +17
-17
lines changed Expand file tree Collapse file tree 5 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,8 @@ EthereumHDKey.fromExtendedKey = function (base58key) {
22
22
}
23
23
24
24
EthereumHDKey . prototype . privateExtendedKey = function ( ) {
25
- // FIXME: change this according to the outcome of https://github.com/cryptocoinjs/hdkey/issues/7
26
- if ( ! this . _hdkey . _privateKey ) {
27
- throw new Error ( 'Private key is not available' )
25
+ if ( ! this . _hdkey . privateExtendedKey ) {
26
+ throw new Error ( 'This is a public key only wallet' )
28
27
}
29
28
return this . _hdkey . privateExtendedKey
30
29
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var Buffer = require('safe-buffer').Buffer
2
2
var ethUtil = require ( 'ethereumjs-util' )
3
3
var crypto = require ( 'crypto' )
4
4
var scryptsy = require ( 'scrypt.js' )
5
- var uuid = require ( 'uuid' )
5
+ var uuidv4 = require ( 'uuid/v4 ' )
6
6
var bs58check = require ( 'bs58check' )
7
7
8
8
function assert ( val , msg ) {
@@ -145,7 +145,7 @@ Wallet.prototype.toV3 = function (password, opts) {
145
145
146
146
return {
147
147
version : 3 ,
148
- id : uuid . v4 ( { random : opts . uuid || crypto . randomBytes ( 16 ) } ) ,
148
+ id : uuidv4 ( { random : opts . uuid || crypto . randomBytes ( 16 ) } ) ,
149
149
address : this . getAddress ( ) . toString ( 'hex' ) ,
150
150
crypto : {
151
151
ciphertext : ciphertext . toString ( 'hex' ) ,
Original file line number Diff line number Diff line change 26
26
},
27
27
"homepage" : " https://github.com/ethereumjs/ethereumjs-wallet" ,
28
28
"dependencies" : {
29
- "aes-js" : " ^0.2.3 " ,
30
- "bs58check" : " ^1.0.8 " ,
31
- "ethereumjs-util" : " ^4.4.0 " ,
32
- "hdkey" : " ^0.7 .0" ,
29
+ "aes-js" : " ^3.1.0 " ,
30
+ "bs58check" : " ^2.1.1 " ,
31
+ "ethereumjs-util" : " ^5.1.4 " ,
32
+ "hdkey" : " ^0.8 .0" ,
33
33
"safe-buffer" : " ^5.1.1" ,
34
34
"scrypt.js" : " ^0.2.0" ,
35
- "utf8" : " ^2.1.1 " ,
36
- "uuid" : " ^2.0 .1"
35
+ "utf8" : " ^3.0.0 " ,
36
+ "uuid" : " ^3.2 .1"
37
37
},
38
38
"devDependencies" : {
39
- "coveralls" : " ^2.11.4 " ,
40
- "istanbul" : " ^0.4.1 " ,
41
- "mocha" : " ^2.3.4 " ,
39
+ "coveralls" : " ^3.0.0 " ,
40
+ "istanbul" : " ^0.4.5 " ,
41
+ "mocha" : " ^5.0.0 " ,
42
42
"standard" : " ^10.0.0"
43
43
},
44
44
"standard" : {
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ describe('.fromExtendedKey()', function () {
32
32
assert . equal ( hdnode . publicExtendedKey ( ) , 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ' )
33
33
assert . throws ( function ( ) {
34
34
hdnode . privateExtendedKey ( )
35
- } , / ^ E r r o r : P r i v a t e k e y i s n o t a v a i l a b l e $ / )
35
+ } , / ^ E r r o r : T h i s i s a p u b l i c k e y o n l y w a l l e t $ / )
36
36
} )
37
37
it ( 'should work with private' , function ( ) {
38
38
var hdnode = HDKey . fromExtendedKey ( 'xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY' )
Original file line number Diff line number Diff line change @@ -203,9 +203,10 @@ Thirdparty.fromKryptoKit = function (entropy, password) {
203
203
/* eslint-disable new-cap */
204
204
var decipher = new aesjs . ModeOfOperation . ecb ( aesKey )
205
205
/* eslint-enable new-cap */
206
+ /* decrypt returns an Uint8Array, perhaps there is a better way to concatenate */
206
207
privKey = Buffer . concat ( [
207
- decipher . decrypt ( encryptedSeed . slice ( 0 , 16 ) ) ,
208
- decipher . decrypt ( encryptedSeed . slice ( 16 , 32 ) )
208
+ Buffer . from ( decipher . decrypt ( encryptedSeed . slice ( 0 , 16 ) ) ) ,
209
+ Buffer . from ( decipher . decrypt ( encryptedSeed . slice ( 16 , 32 ) ) )
209
210
] )
210
211
211
212
if ( checksum . length > 0 ) {
You can’t perform that action at this time.
0 commit comments