Implement intel tee version detection.

This commit is contained in:
Andy Phillipson 2017-03-21 10:09:50 -04:00
commit 80f3b70784
4 changed files with 36 additions and 4 deletions

View file

@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('preferencesExternalController
$scope.externalSource = lodash.find(walletService.externalSource, function(source) {
return source.id == wallet.getPrivKeyExternalSourceName();
}).name;
});
$scope.showMneumonicFromHardwarePopup = function() {
var title = gettextCatalog.getString('Warning!');

View file

@ -7,6 +7,7 @@ angular.module('copayApp.services')
root.description = {
supported: platformInfo.supportsIntelTEE,
version: platformInfo.versionIntelTEE,
id: 'intelTEE',
name: 'Intel TEE',
longName: 'Intel TEE Hardware Wallet',

View file

@ -23,6 +23,27 @@ angular.module('copayApp.services').factory('platformInfo', function($window) {
}
};
var getVersionIntelTee = function() {
var v = '';
var isWindows = navigator.platform.indexOf('Win') > -1;
if (!isNodeWebkit() || !isWindows) {
return v;
}
try {
var IntelWallet = require('intelWalletCon');
if (IntelWallet.getVersion) {
v = IntelWallet.getVersion();
} else {
v = 'Alpha';
}
if (v.length > 0) {
$log.info('Intel TEE library ' + v);
}
} catch (e) {}
return v;
};
// Detect mobile devices
var ret = {
@ -38,11 +59,12 @@ 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.isWindows = navigator.platform.indexOf('Win') > -1;
ret.supportsLedger = ret.isChromeApp;
ret.supportsTrezor = ret.isChromeApp || ret.isDevel;
ret.supportsIntelTEE = ret.isWindows; // TODO need to detect specific chip set for TEE support
ret.versionIntelTEE = getVersionIntelTee();
ret.supportsIntelTEE = ret.versionIntelTEE.length > 0;
return ret;
});

View file

@ -1,10 +1,19 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{externalSource}}</ion-nav-title>
<ion-nav-title>{{externalSource.longName}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content>
<div class="list">
<div class="item">
<span translate>Version</span>
<span class="item-note">
{{externalSource.version}}
</span>
</div>
</div>
<div class="padding">
<button class="button button-standard button-assertive" ng-click="showMneumonicFromHardwarePopup()">
{{'Show Recovery Phrase'|translate}}