diff --git a/config.js b/config.js index 57f24538d..3113c9b8e 100644 --- a/config.js +++ b/config.js @@ -42,7 +42,7 @@ var defaultConfig = { // local encryption/security config passphraseConfig: { - iterations: 1000, + iterations: 5000, storageSalt: 'mjuBtGybi/4=', }, diff --git a/cordova/config.xml b/cordova/config.xml index 44ddd11f9..6788e1a9f 100644 --- a/cordova/config.xml +++ b/cordova/config.xml @@ -1,8 +1,8 @@ + ios-CFBundleVersion="0.8.3"> Copay A secure bitcoin wallet for friends and companies. diff --git a/cordova/ios/Copay-Info.plist b/cordova/ios/Copay-Info.plist index 82021dce2..52030f728 100644 --- a/cordova/ios/Copay-Info.plist +++ b/cordova/ios/Copay-Info.plist @@ -57,11 +57,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - vRC0.9.0 + 0.8.3 CFBundleSignature ???? CFBundleVersion - vRC0.9.0 + 0.8.3 LSRequiresIPhoneOS NSMainNibFile diff --git a/index.html b/index.html index 73e813b51..441edb926 100644 --- a/index.html +++ b/index.html @@ -43,7 +43,7 @@

Your session is about to expire due to inactivity in {{countdown}} seconds

-
+
@@ -62,7 +62,7 @@
-
+
@@ -73,13 +73,13 @@
- + - +
= 0 || msg.indexOf('BADC') >= 0) { msg = 'This profile already exists' + $scope.createStep = 'email'; } $scope.error = msg; } else { @@ -156,6 +158,8 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun return; } $scope.saveSettings(function(err) { + preconditions.checkState(!err,err); + $scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) { $timeout(function() { form.password.$setViewValue(''); diff --git a/js/controllers/head.js b/js/controllers/head.js index 4d32b7331..a2b2e40db 100644 --- a/js/controllers/head.js +++ b/js/controllers/head.js @@ -15,7 +15,6 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc }; $scope.signout = function() { - $rootScope.signingOut = true; identityService.signout(); }; diff --git a/js/controllers/home.js b/js/controllers/home.js index 9d0285644..8db396afe 100644 --- a/js/controllers/home.js +++ b/js/controllers/home.js @@ -1,10 +1,11 @@ 'use strict'; -angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility, pinService, applicationService, isMobile) { +angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $timeout, go, notification, identityService, Compatibility, pinService, applicationService, isMobile) { - // Global functions (TODO should be somewhere else) + // Global go. This should be in a better place TODO + // We dont do a 'go' directive, to use the benefits of ng-touch with ng-click $rootScope.go = function (path) { - $location.path(path); + go.go(path); }; var _credentials, _firstpin; @@ -66,13 +67,14 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc $scope.error = 'Please enter the required fields'; return; } + $rootScope.starting = true; var credentials = pinService.get(pin, function(err, credentials) { if (err || !credentials) { + $rootScope.starting = false; $scope.error = 'Wrong PIN'; return; } - $rootScope.starting = true; $scope.open(credentials.email, credentials.password); }); }; @@ -114,7 +116,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc pinService.clear(function() { copay.logger.debug('PIN erased'); delete $rootScope['hasPin']; - applicationService.reload(); + applicationService.restart(); }); }; @@ -162,7 +164,9 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc $scope.askForPin = 1; $rootScope.starting = false; $rootScope.hideNavigation = true; - $rootScope.$digest(); + $timeout(function(){ + $rootScope.$digest(); + }); return; } // no mobile diff --git a/js/controllers/settings.js b/js/controllers/settings.js index 9a0a93fd4..3c09a26e9 100644 --- a/js/controllers/settings.js +++ b/js/controllers/settings.js @@ -21,7 +21,7 @@ angular.module('copayApp.controllers').controller('SettingsController', function name: 'In the cloud (Insight server)', pluginName: 'EncryptedInsightStorage', }, { - name: 'In this device (localstorage)', + name: 'On this device (localstorage)', pluginName: 'EncryptedLocalStorage', }, // { diff --git a/js/controllers/sidebar.js b/js/controllers/sidebar.js index 52c1f04d2..b14d23d93 100644 --- a/js/controllers/sidebar.js +++ b/js/controllers/sidebar.js @@ -27,7 +27,6 @@ angular.module('copayApp.controllers').controller('SidebarController', function( }]; $scope.signout = function() { - $rootScope.signingOut = true; identityService.signout(); }; diff --git a/js/init.js b/js/init.js index 3f4432b38..61497168a 100644 --- a/js/init.js +++ b/js/init.js @@ -1,13 +1,21 @@ 'use strict'; angular.element(document).ready(function() { - var startAngular = function () { + var startAngular = function() { angular.bootstrap(document, ['copayApp']); }; - + /* Cordova specific Init */ if (window.cordova !== undefined) { + document.addEventListener('deviceready', function() { - setTimeout(function(){ navigator.splashscreen.hide(); }, 2000); + + document.addEventListener('pause', function() { + window.location = '#!'; + }); + + setTimeout(function() { + navigator.splashscreen.hide(); + }, 2000); function handleBitcoinURI(url) { if (!url) return; diff --git a/js/routes.js b/js/routes.js index 39a207902..c295994b4 100644 --- a/js/routes.js +++ b/js/routes.js @@ -113,16 +113,17 @@ angular $idleProvider.warningDuration(40); // in seconds $keepaliveProvider.interval(30); // in seconds }) - .run(function($rootScope, $location, $idle, gettextCatalog, uriHandler) { + .run(function($rootScope, $location, $idle, gettextCatalog, uriHandler, isCordova) { + gettextCatalog.currentLanguage = config.defaultLanguage; - // not for mobileApp - if (!window.cordova) { + + // Register URI handler, not for mobileApp + if (!isCordova) { $idle.watch(); uriHandler.register(); } + $rootScope.$on('$routeChangeStart', function(event, next, current) { - - if (!ls || ls.length < 1) { $location.path('unsupported'); } else { diff --git a/js/services/applicationService.js b/js/services/applicationService.js index 4c3bade19..866442fcf 100644 --- a/js/services/applicationService.js +++ b/js/services/applicationService.js @@ -1,22 +1,27 @@ 'use strict'; angular.module('copayApp.services') - .factory('applicationService', function() { + .factory('applicationService', function($rootScope, $location, $timeout, go, isCordova) { var root = {}; var isChromeApp = window.chrome && chrome.runtime && chrome.runtime.id; root.restart = function() { - - // Go home reloading the application - var hashIndex = window.location.href.indexOf('#!/'); - if (isChromeApp) { - chrome.runtime.reload(); + if (isCordova) { + $rootScope.iden = $rootScope.wallet = undefined; + go.go('/'); + $timeout(function(){ + $rootScope.$digest(); + },1); + } else { - window.location = window.location.href.substr(0, hashIndex); - } - }; - root.reload = function() { - window.location.reload(); + // Go home reloading the application + var hashIndex = window.location.href.indexOf('#!/'); + if (isChromeApp) { + chrome.runtime.reload(); + } else { + window.location = window.location.href.substr(0, hashIndex); + } + } }; return root; diff --git a/js/services/go.js b/js/services/go.js new file mode 100644 index 000000000..f0a71785d --- /dev/null +++ b/js/services/go.js @@ -0,0 +1,26 @@ +'use strict'; + +angular.module('copayApp.services').factory('go', function($window, $location) { + var root = {}; + + var hideSidebars = function() { + if (typeof document === 'undefined') + return; + + // hack to hide sidebars and use ng-click (no href=) + var win = angular.element($window); + var elem = angular.element(document.querySelector('#off-canvas-wrap')) + elem.removeClass('move-right'); + elem.removeClass('move-left'); + }; + + root.go = function(path) { + var parts = path.split('#'); + $location.path(parts[0]); + if (parts[1]) + $location.hash(parts[1]); + hideSidebars(); + }; + + return root; +}); diff --git a/js/services/identityService.js b/js/services/identityService.js index 1c9c14468..ad073f65b 100644 --- a/js/services/identityService.js +++ b/js/services/identityService.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.services') - .factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService) { + .factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService, go) { notification.enableHtml5Mode(); // for chrome: if support, enable it // TODO: @@ -328,11 +328,13 @@ angular.module('copayApp.services') }; root.signout = function() { + $rootScope.signingOut = true; if ($rootScope.iden) { $rootScope.iden.store({ noWallets: true }, function() { - $rootScope.iden.close(); + $rootScope.signingOut = false; + $rootScope.iden.close(); // Will trigger 'closed' }); } }; diff --git a/js/services/isCordova.js b/js/services/isCordova.js new file mode 100644 index 000000000..180ace923 --- /dev/null +++ b/js/services/isCordova.js @@ -0,0 +1,3 @@ +'use strict'; + +angular.module('copayApp.services').value('isCordova', window.cordova ? true : false); diff --git a/js/services/pinService.js b/js/services/pinService.js index c5562029a..f320f3a3c 100644 --- a/js/services/pinService.js +++ b/js/services/pinService.js @@ -5,7 +5,7 @@ angular.module('copayApp.services') var KEY = 'pinDATA'; var SALT = '4gllotIKguqi0EkIslC0'; - var ITER = 2000; + var ITER = 5000; var ls = localstorageService; var root = {}; diff --git a/js/util/crypto.js b/js/util/crypto.js index 72679f18f..88c821363 100644 --- a/js/util/crypto.js +++ b/js/util/crypto.js @@ -76,7 +76,7 @@ module.exports = { try { return sjcl.decrypt(key, sjclEncryptedJson); } catch (e) { - log.info('Decryption failed due to error: ' + e.message); + log.debug('Decryption failed due to error: ' + e.message); return null; } } diff --git a/package.json b/package.json index 8d19cc16c..b53ed4117 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "copay", "description": "A multisignature wallet", "author": "BitPay", - "version": "0.8.2", + "version": "0.8.3", "keywords": [ "wallet", "copay", @@ -41,7 +41,8 @@ "setup-shell": "node shell/scripts/download-atom-shell.js", "postinstall": "./node_modules/.bin/grunt", "sign": "gpg -u 1112CFA1 --output browser-extensions/firefox/copay.xpi.sig --detach-sig browser-extensions/firefox/copay.xpi; gpg -u 1112CFA1 --output browser-extensions/chrome/copay-chrome-extension.zip.sig --detach-sig browser-extensions/chrome/copay-chrome-extension.zip", - "verify": "gpg --verify browser-extensions/firefox/copay.xpi.sig browser-extensions/firefox/copay.xpi; gpg --verify browser-extensions/chrome/copay-chrome-extension.zip.sig browser-extensions/chrome/copay-chrome-extension.zip" + "verify": "gpg --verify browser-extensions/firefox/copay.xpi.sig browser-extensions/firefox/copay.xpi; gpg --verify browser-extensions/chrome/copay-chrome-extension.zip.sig browser-extensions/chrome/copay-chrome-extension.zip", + "ios": "cordova/build.sh && cd cordova/project && cordova build ios && open platforms/ios/Copay.xcodeproj" }, "devDependencies": { "angular-gravatar": "*", diff --git a/test/util.crypto.js b/test/util.crypto.js index c6171e1ea..2adad0a5e 100644 --- a/test/util.crypto.js +++ b/test/util.crypto.js @@ -81,7 +81,7 @@ describe('crypto utils', function() { }); it('should generate a passphrase using default salt/iter', function() { var phrase = cryptoUtils.kdf('Pwd123!@#$%^&*(){}[]\|/?.>,<=+-_`~åéþ䲤þçæ¶'); - var expected = 'ml+mMtjgcvL2pdfDwQqW2qONRNjZ3YD8KnGeV3aFjyOoM0ByOmoREw9zBvowC/ZXsfrezbRXX/W/XIzKOqdrXA=='; + var expected = 'n9QYDBJvRCHfpAfp8X/Z1XDA00CnZtnehLKOVrtNYTLt9H+hlcyaZgbAGGgJ/dVRCsVtIBzYwaACNPckknMiCg=='; phrase.should.equal(expected); }); diff --git a/views/createProfile.html b/views/createProfile.html index b0c285d31..84a5c83c4 100644 --- a/views/createProfile.html +++ b/views/createProfile.html @@ -23,9 +23,34 @@
Copay -
+ +
+ clipo +
+ +
+
+ clipo +
+
+ clipo +
+

Creating in the cloud

+

Creating on this device

+
+ +
+
+ clipo +
+ +

Creating on this device

+

Creating in the cloud

+
{{userOrEmail}}
+
+
@@ -37,54 +62,52 @@
-
- clipo -
- In the Cloud
+ In the Cloud +
( Recommended )
-
-
-
- Access your wallets anywhere +
+
-
-
-
- Backups managed by the server + Access your wallets anywhere +
+
+
-
-
-
- Email address confirmation needed + Backups managed by the server +
+
+
+ Email address confirmation needed +
-
On this Device
+
On this Device
-
-
-
- Your private keys never leave this device +
+
-
-
-
- No email required + Your private keys never leave this device +
+
+
-
-
-
- Need to be careful with backups + No email required +
+
+
+ Need to be careful with backups +
- @@ -97,25 +120,14 @@
- +
-
- clipo -
-
- clipo -
- -

Creating in the cloud

-

Creating on this device

-
@@ -128,7 +140,8 @@
+ !emailForm.email.$pristine"> +
@@ -139,9 +152,7 @@ + - +
-
- clipo -
- -

Creating on this device

-

Creating in the cloud

-
{{userOrEmail}}
- -
@@ -180,7 +182,8 @@
+ !passForm.repeatpassword.$invalid"> +
@@ -202,45 +205,43 @@
-
-

Set up a PIN ?

-

Enter a 4-digit number for easier access from this device

+

Set up a PIN ?

+

Enter a 4-digit number for easier access from this device

-
-
- -
- +
+
+ +
+ {{error|translate}} +
+ + +
+ + +
+
+ +
- -
- - + +
diff --git a/views/home.html b/views/home.html index a166c3651..5628ab123 100644 --- a/views/home.html +++ b/views/home.html @@ -23,7 +23,7 @@
Copay -
+
@@ -115,7 +115,6 @@
clipo
-

Sign in to Copay

diff --git a/views/includes/sidebar-mobile.html b/views/includes/sidebar-mobile.html index 3c536466d..608ed846a 100644 --- a/views/includes/sidebar-mobile.html +++ b/views/includes/sidebar-mobile.html @@ -1,7 +1,7 @@