Improve detection of supported hw wallets.
This commit is contained in:
parent
0c69dfb061
commit
8d63fa3507
6 changed files with 30 additions and 27 deletions
|
|
@ -1,11 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('createController',
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) {
|
||||
|
||||
/* For compressed keys, m*73 + n*34 <= 496 */
|
||||
var COPAYER_PAIR_LIMITS = {
|
||||
|
|
@ -67,9 +63,6 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
var seedOptions = [{
|
||||
id: 'new',
|
||||
label: gettextCatalog.getString('Random'),
|
||||
}, {
|
||||
id: walletService.externalSource.intelTEE.id,
|
||||
label: gettextCatalog(walletService.externalSource.intelTEE.name),
|
||||
}, {
|
||||
id: 'set',
|
||||
label: gettextCatalog.getString('Specify Recovery Phrase...'),
|
||||
|
|
@ -84,18 +77,25 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
*/
|
||||
|
||||
if (appConfigService.name == 'copay') {
|
||||
if (n > 1 && isChromeApp)
|
||||
if (n > 1 && walletService.externalSource.ledger.supported)
|
||||
seedOptions.push({
|
||||
id: walletService.externalSource.ledger.id,
|
||||
label: walletService.externalSource.ledger.longName,
|
||||
});
|
||||
|
||||
if (isChromeApp || isDevel) {
|
||||
if (walletService.externalSource.trezor.supported) {
|
||||
seedOptions.push({
|
||||
id: walletService.externalSource.trezor.id,
|
||||
label: walletService.externalSource.trezor.longName,
|
||||
});
|
||||
}
|
||||
|
||||
if (walletService.externalSource.intelTEE.supported) {
|
||||
seedOptions.push({
|
||||
id: walletService.externalSource.intelTEE.id,
|
||||
label: walletService.externalSource.intelTEE.longName,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.seedOptions = seedOptions;
|
||||
|
|
@ -179,7 +179,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
src = intelTEE;
|
||||
break;
|
||||
default:
|
||||
this.error = gettextCatalog('Invalid seed source id: ' + self.seedSourceId);
|
||||
this.error = gettextCatalog.getString('Invalid seed source id: ' + self.seedSourceId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) {
|
||||
|
||||
var self = this;
|
||||
var defaults = configService.getDefaults();
|
||||
|
|
@ -64,14 +61,14 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
*/
|
||||
|
||||
if (appConfigService.name == 'copay') {
|
||||
if (isChromeApp) {
|
||||
if (walletService.externalSource.ledger.supported) {
|
||||
self.seedOptions.push({
|
||||
id: walletService.externalSource.ledger.id,
|
||||
label: walletService.externalSource.ledger.longName,
|
||||
});
|
||||
}
|
||||
|
||||
if (isChromeApp || isDevel) {
|
||||
if (walletService.externalSource.trezor.supported) {
|
||||
self.seedOptions.push({
|
||||
id: walletService.externalSource.trezor.id,
|
||||
label: walletService.externalSource.trezor.longName,
|
||||
|
|
|
|||
|
|
@ -5,20 +5,21 @@ angular.module('copayApp.services')
|
|||
|
||||
var root = {};
|
||||
|
||||
if (!platformInfo.isIntelTEE) {
|
||||
return root;
|
||||
}
|
||||
|
||||
var IntelWallet = require('intelWalletCon');
|
||||
var TEE_APP_ID = '63279de1b6cb4dcf8c206716bd318092f8c206716bd31809263279de1b6cb4dc';
|
||||
|
||||
root.description = {
|
||||
supports: platformInfo.supportsIntelTEE,
|
||||
id: 'intelTEE',
|
||||
name: 'Intel TEE',
|
||||
longName: 'Intel TEE Hardware Wallet',
|
||||
derivationStrategy: 'BIP44'
|
||||
};
|
||||
|
||||
if (!root.description.isAvailable) {
|
||||
return root;
|
||||
}
|
||||
|
||||
var IntelWallet = require('intelWalletCon');
|
||||
var TEE_APP_ID = '63279de1b6cb4dcf8c206716bd318092f8c206716bd31809263279de1b6cb4dc';
|
||||
|
||||
root.walletEnclave = new IntelWallet.Wallet();
|
||||
var walletEnclaveStatus = root.walletEnclave.initializeEnclave();
|
||||
if (walletEnclaveStatus != 0) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services')
|
||||
.factory('ledger', function($log, bwcService, gettext, hwWallet) {
|
||||
.factory('ledger', function($log, bwcService, gettext, hwWallet, platformInfo) {
|
||||
var root = {};
|
||||
var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf";
|
||||
|
||||
root.description = {
|
||||
supports: platformInfo.supportsLedger,
|
||||
id: 'ledger',
|
||||
name: 'Ledger',
|
||||
longName: 'Ledger Hardware Wallet'
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ angular.module('copayApp.services').factory('platformInfo', function($window) {
|
|||
ret.isMobile = ret.isAndroid || ret.isIOS || ret.isWP;
|
||||
ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW;
|
||||
ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW;
|
||||
ret.isIntelTEE = true;
|
||||
|
||||
ret.supportsLedger = ret.isChromeApp;
|
||||
ret.supportsTrezor = ret.isChromeApp || ret.isDevel;
|
||||
ret.supportsIntelTEE = false;
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services')
|
||||
.factory('trezor', function($log, $timeout, lodash, bitcore, hwWallet) {
|
||||
.factory('trezor', function($log, $timeout, lodash, bitcore, hwWallet, platformInfo) {
|
||||
var root = {};
|
||||
|
||||
var SETTLE_TIME = 3000;
|
||||
root.callbacks = {};
|
||||
|
||||
root.description = {
|
||||
supported: platformInfo.supportsTrezor,
|
||||
id: 'trezor',
|
||||
name: 'Trezor',
|
||||
longName: 'Trezor Hardware Wallet',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue