Bug fixes - ledger testing

This commit is contained in:
Andy Phillipson 2017-04-07 10:54:30 -04:00
parent c0e90ac21a
commit 413990f94c
9 changed files with 67 additions and 56 deletions

View File

@ -183,7 +183,7 @@ angular.module('copayApp.controllers').controller('createController',
return;
}
src.getInfoForNewWallet(opts, function(err, lopts) {
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
ongoingProcess.set('connecting' + $scope.seedSource.id, false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);

View File

@ -35,7 +35,7 @@ angular.module('copayApp.controllers').controller('importController',
if ($scope.isChromeApp || $scope.isDevel) {
$scope.seedOptions.push({
id: walletService.externalSource.trezor.id,
label: walletService.externalSource.ledger.longName,
label: walletService.externalSource.trezor.longName,
});
$scope.formData.seedSource = $scope.seedOptions[0];
}

View File

@ -138,6 +138,7 @@ angular.module('copayApp.controllers').controller('joinController',
account = account - 1;
opts.account = account;
opts.isMultisig = true;
ongoingProcess.set('connecting' + self.seedSourceId, true);
var src = self.seedSourceId == walletService.externalSource.ledger.id ? ledger : trezor;

View File

@ -8,20 +8,22 @@ angular.module('copayApp.controllers').controller('preferencesExternalController
return source.id == wallet.getPrivKeyExternalSourceName();
});
$scope.hardwareConnected = $scope.externalSource.version.length > 0;
if ($scope.externalSource.hasEmbeddedHardware) {
$scope.hardwareConnected = $scope.externalSource.version.length > 0;
$scope.showMneumonicFromHardwarePopup = function() {
var title = gettextCatalog.getString('Warning!');
var message = gettextCatalog.getString('Are you being watched? Anyone with your recovery phrase can access or spend your bitcoin.');
popupService.showConfirm(title, message, null, null, function(res) {
if (res) {
walletService.showMneumonicFromHardware(wallet, function(err) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
}
});
}
});
};
$scope.showMneumonicFromHardwarePopup = function() {
var title = gettextCatalog.getString('Warning!');
var message = gettextCatalog.getString('Are you being watched? Anyone with your recovery phrase can access or spend your bitcoin.');
popupService.showConfirm(title, message, null, null, function(res) {
if (res) {
walletService.showMneumonicFromHardware(wallet, function(err) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
}
});
}
});
};
}
});

View File

@ -11,7 +11,8 @@ angular.module('copayApp.services')
id: 'intelTEE',
name: 'Intel TEE',
longName: 'Intel TEE Hardware Wallet',
derivationStrategy: 'BIP44'
derivationStrategy: 'BIP44',
hasEmbeddedHardware: true
};
if (!root.description.supported) {
@ -27,16 +28,16 @@ angular.module('copayApp.services')
$log.error('Failed to create Intel Wallet enclave');
}
root.getInfoForNewWallet = function(opts, callback) {
root.getInfoForNewWallet = function(isMultisig, account, callback) {
var opts = {};
initSource(opts, function(err, opts) {
if (err) return callback(err);
var isMultisig = opts.n > 1;
root.getEntropySource(opts.hwInfo.id, isMultisig, opts.account, function(err, entropySource) {
root.getEntropySource(opts.hwInfo.id, isMultisig, account, function(err, entropySource) {
if (err) return callback(err);
opts.entropySource = entropySource;
root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, opts.account, opts.networkName), function(data) {
root.getXPubKey(opts.hwInfo.id, hwWallet.getAddressPath(root.description.id, isMultisig, account, opts.networkName), function(data) {
if (!data.success) {
$log.warn(data.message);
return callback(data);

View File

@ -9,7 +9,8 @@ angular.module('copayApp.services')
supported: platformInfo.supportsLedger,
id: 'ledger',
name: 'Ledger',
longName: 'Ledger Hardware Wallet'
longName: 'Ledger Hardware Wallet',
hasEmbeddedHardware: false
};
root.callbacks = {};
@ -42,13 +43,13 @@ angular.module('copayApp.services')
return callback(opts);
};
root.getInfoForNewWallet = function(opts, callback) {
var isMultisig = opts.n > 1;
root.getEntropySource(isMultisig, opts.account, function(err, entropySource) {
root.getInfoForNewWallet = function(isMultisig, account, callback) {
root.getEntropySource(isMultisig, account, function(err, entropySource) {
if (err) return callback(err);
var opts = {};
opts.entropySource = entropySource;
root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, opts.account), function(data) {
root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, account), function(data) {
if (!data.success) {
$log.warn(data.message);
return callback(data);

View File

@ -12,7 +12,8 @@ angular.module('copayApp.services')
id: 'trezor',
name: 'Trezor',
longName: 'Trezor Hardware Wallet',
derivationStrategy: 'BIP48'
derivationStrategy: 'BIP48',
hasEmbeddedHardware: false
};
root.getEntropySource = function(isMultisig, account, callback) {
@ -39,15 +40,15 @@ angular.module('copayApp.services')
return callback(opts);
};
root.getInfoForNewWallet = function(opts, callback) {
var isMultisig = opts.n > 1;
root.getEntropySource(isMultisig, opts.account, function(err, data) {
root.getInfoForNewWallet = function(isMultisig, account, callback) {
var opts = {};
root.getEntropySource(isMultisig, account, function(err, data) {
if (err) return callback(err);
opts.entropySource = data;
$log.debug('Waiting TREZOR to settle...');
$timeout(function() {
root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, opts.account), function(data) {
root.getXPubKey(hwWallet.getAddressPath(root.description.id, isMultisig, account), function(data) {
if (!data.success)
return callback(hwWallet._err(data));

View File

@ -4,16 +4,11 @@
<div>
<span ng-show="wallet.status.wallet.singleAddress" class="size-12"><span translate>Auditable</span></span>
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.network != 'livenet'" src="img/icon-testnet-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'trezor'"
src="img/icon-trezor-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'ledger'"
src="img/icon-ledger-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'intelTEE'"
src="img/icon-inteltee-white.svg">
<span class="size-12 dib" style="height:0.6em; margin-right: 1px;" ng-show="wallet.account">#{{wallet.account || 0}} </span>
<img style="height:0.6em; margin-right: 1px;" ng-show="!wallet.canSign() && !wallet.isPrivKeyExternal()" src="img/icon-read-only-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'trezor'" src="img/icon-trezor-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'ledger'" src="img/icon-ledger-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'trezor'" src="img/icon-trezor-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'ledger'" src="img/icon-ledger-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="wallet.getPrivKeyExternalSourceName() == 'intelTEE'" src="img/icon-inteltee-white.svg">
<span ng-show="wallet.credentials.n > 1" class="size-12"><span translate>{{wallet.m}}-of-{{wallet.n}}</span></span>
<span class="size-12 dib" style="height:0.6em; margin-right: 1px;" ng-show="wallet.credentials.account">#{{wallet.credentials.account || 0}} </span>

View File

@ -6,26 +6,36 @@
</ion-nav-bar>
<ion-content>
<div ng-include="'views/includes/walletItem.html'"></div>
<div ng-if="!hardwareConnected" class="warning centered">
<span translate>Hardware not connected.</span><br>
<span translate>Check installation and retry.</span>
<div ng-if="!hasEmbeddedHardware">
<div ng-if="!hardwareConnected" class="info centered">
<span translate>No hardware information available.</span>
</div>
</div>
<div ng-if="hardwareConnected">
<div class="list">
<div class="item">
<span translate>Version</span>
<span class="item-note">
{{externalSource.version || 'hardware disconnected'}}
</span>
<div ng-if="hasEmbeddedHardware">
<div ng-if="!hardwareConnected" class="warning centered">
<span translate>Hardware not connected.</span><br>
<span translate>Check installation and retry.</span>
</div>
<div ng-if="hardwareConnected">
<div class="list">
<div class="item">
<span translate>Version</span>
<span class="item-note">
{{externalSource.version || 'hardware disconnected'}}
</span>
</div>
</div>
<div class="padding">
<button class="button button-standard button-assertive" ng-click="showMneumonicFromHardwarePopup()">
{{'Show Recovery Phrase'|translate}}
</button>
</div>
</div>
<div class="padding">
<button class="button button-standard button-assertive" ng-click="showMneumonicFromHardwarePopup()">
{{'Show Recovery Phrase'|translate}}
</button>
</div>
</div>
</ion-content>
</ion-view>