From 6718ced346ef934e1458553c52ba86eaec17f954 Mon Sep 17 00:00:00 2001 From: hackyminer Date: Sat, 15 Dec 2018 21:33:36 +0900 Subject: [PATCH 1/2] misc fixes * fixed keystore mimetype as "application/json" * add ".json" extension to blob * make "crypto" attribute lowercase (fix #1635) --- app/scripts/controllers/bulkGenCtrl.js | 2 +- app/scripts/controllers/viewWalletCtrl.js | 4 ++-- app/scripts/controllers/walletGenCtrl.js | 4 ++-- app/scripts/myetherwallet.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/scripts/controllers/bulkGenCtrl.js b/app/scripts/controllers/bulkGenCtrl.js index 21923949f4..4b1c3731e2 100644 --- a/app/scripts/controllers/bulkGenCtrl.js +++ b/app/scripts/controllers/bulkGenCtrl.js @@ -18,7 +18,7 @@ var bulkGenCtrl = function($scope) { $scope.wallets.push(tWallet); } $scope.showWallets = true; - $scope.bJSON = globalFuncs.getBlob("text/json;charset=UTF-8",JSON.stringify($scope.jsonWallets)); + $scope.bJSON = globalFuncs.getBlob("application/json;charset=UTF-8",JSON.stringify($scope.jsonWallets)); $scope.bTXT = globalFuncs.getBlob("text/plain;charset=UTF-8",txt); $scope.bCSV = globalFuncs.getBlob("text/csv;charset=UTF-8",csv); } diff --git a/app/scripts/controllers/viewWalletCtrl.js b/app/scripts/controllers/viewWalletCtrl.js index 56d575f927..2167ab8529 100644 --- a/app/scripts/controllers/viewWalletCtrl.js +++ b/app/scripts/controllers/viewWalletCtrl.js @@ -19,9 +19,9 @@ var viewWalletCtrl = function($scope, walletService) { $scope.wallet = walletService.wallet; $scope.wd = true; $scope.showEnc = walletService.password != ''; - if (walletService.wallet.type == "default") $scope.blob = globalFuncs.getBlob("text/json;charset=UTF-8", $scope.wallet.toJSON()); + if (walletService.wallet.type == "default") $scope.blob = globalFuncs.getBlob("application/json;charset=UTF-8", $scope.wallet.toJSON()); if (walletService.password != '') { - $scope.blobEnc = globalFuncs.getBlob("text/json;charset=UTF-8", $scope.wallet.toV3(walletService.password, { + $scope.blobEnc = globalFuncs.getBlob("application/json;charset=UTF-8", $scope.wallet.toV3(walletService.password, { kdf: globalFuncs.kdf, n: globalFuncs.scrypt.n })); diff --git a/app/scripts/controllers/walletGenCtrl.js b/app/scripts/controllers/walletGenCtrl.js index 0bc7e3e055..0459641be6 100644 --- a/app/scripts/controllers/walletGenCtrl.js +++ b/app/scripts/controllers/walletGenCtrl.js @@ -28,8 +28,8 @@ var walletGenCtrl = function($scope) { $scope.isDone = false; $scope.wallet = Wallet.generate(false); $scope.showWallet = true; - $scope.blob = globalFuncs.getBlob("text/json;charset=UTF-8", $scope.wallet.toJSON()); - $scope.blobEnc = globalFuncs.getBlob("text/json;charset=UTF-8", $scope.wallet.toV3($scope.password, { + $scope.blob = globalFuncs.getBlob("application/json;charset=UTF-8", $scope.wallet.toJSON()); + $scope.blobEnc = globalFuncs.getBlob("application/json;charset=UTF-8", $scope.wallet.toV3($scope.password, { kdf: globalFuncs.kdf, n: globalFuncs.scrypt.n })); diff --git a/app/scripts/myetherwallet.js b/app/scripts/myetherwallet.js index b9d293995f..5499e67a9b 100644 --- a/app/scripts/myetherwallet.js +++ b/app/scripts/myetherwallet.js @@ -228,7 +228,7 @@ Wallet.prototype.toV3 = function(password, opts) { random: opts.uuid || ethUtil.crypto.randomBytes(16) }), address: this.getAddress().toString('hex'), - Crypto: { + crypto: { ciphertext: ciphertext.toString('hex'), cipherparams: { iv: iv.toString('hex') @@ -351,7 +351,7 @@ Wallet.prototype.toV3String = function(password, opts) { } Wallet.prototype.getV3Filename = function(timestamp) { var ts = timestamp ? new Date(timestamp) : new Date() - return ['UTC--', ts.toJSON().replace(/:/g, '-'), '--', this.getAddress().toString('hex')].join('') + return ['UTC--', ts.toJSON().replace(/:/g, '-'), '--', this.getAddress().toString('hex'), '.json'].join('') } Wallet.decipherBuffer = function(decipher, data) { return Buffer.concat([decipher.update(data), decipher.final()]) From 21f142f73e1aa08a8ebcccb69c783893ad105c73 Mon Sep 17 00:00:00 2001 From: Gamaliel 'Yel' Padillo Date: Thu, 20 Dec 2018 15:58:07 -0800 Subject: [PATCH 2/2] Revert changes to wallet --- app/scripts/myetherwallet.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/myetherwallet.js b/app/scripts/myetherwallet.js index 5499e67a9b..b9d293995f 100644 --- a/app/scripts/myetherwallet.js +++ b/app/scripts/myetherwallet.js @@ -228,7 +228,7 @@ Wallet.prototype.toV3 = function(password, opts) { random: opts.uuid || ethUtil.crypto.randomBytes(16) }), address: this.getAddress().toString('hex'), - crypto: { + Crypto: { ciphertext: ciphertext.toString('hex'), cipherparams: { iv: iv.toString('hex') @@ -351,7 +351,7 @@ Wallet.prototype.toV3String = function(password, opts) { } Wallet.prototype.getV3Filename = function(timestamp) { var ts = timestamp ? new Date(timestamp) : new Date() - return ['UTC--', ts.toJSON().replace(/:/g, '-'), '--', this.getAddress().toString('hex'), '.json'].join('') + return ['UTC--', ts.toJSON().replace(/:/g, '-'), '--', this.getAddress().toString('hex')].join('') } Wallet.decipherBuffer = function(decipher, data) { return Buffer.concat([decipher.update(data), decipher.final()])