added code, icons and css for sign and verify message

This commit is contained in:
Kadir Sekha 2018-03-22 15:44:21 +09:00
commit ef6a572b87
11 changed files with 271 additions and 1 deletions

View file

@ -0,0 +1,27 @@
'use strict';
angular.module('copayApp.controllers').controller('signMessageController', function($scope, $interval, profileService, walletService, popupService, lodash, $ionicNavBarDelegate, signVerifyMessageService) {
$scope.message = {};
$scope.message.value = "";
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.walletSelectorTitle = 'Wallets';
$scope.wallets = profileService.getWallets();
$scope.wallet = $scope.wallets[0];
$scope.showWallets = false;
$scope.singleWallet = $scope.wallets.length > 1;
});
$scope.showWalletSelector = function() {
$scope.showWallets = true;
}
$scope.onWalletSelect = function(wallet) {
$scope.wallet = wallet;
}
$scope.signMessage = function() {
$scope.signedMessage = signVerifyMessageService.signMessage($scope.wallet, $scope.message.value);
}
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, startupService, addressbookService, feedbackService, bwcError, nextStepsService, buyAndSellService, homeIntegrationsService, bitpayCardService, pushNotificationsService, timeService, bitcoincomService, pricechartService, firebaseEventsService, servicesService, shapeshiftService, $ionicNavBarDelegate) {
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, startupService, addressbookService, feedbackService, bwcError, nextStepsService, buyAndSellService, homeIntegrationsService, bitpayCardService, pushNotificationsService, timeService, bitcoincomService, pricechartService, firebaseEventsService, servicesService, shapeshiftService, $ionicNavBarDelegate, signVerifyMessageService) {
var wallet;
var listeners = [];
var notifications = [];

View file

@ -0,0 +1,4 @@
'use strict';
angular.module('copayApp.controllers').controller('verifyMessageController', function($scope, $interval, profileService, walletService, popupService, lodash, $ionicNavBarDelegate, signVerifyMessageService) {
});

View file

@ -1016,6 +1016,26 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
/* Message Signing and Verification */
.state('tabs.signMessage', {
url: '/signMessage',
views: {
'tab-home@tabs': {
controller: 'signMessageController',
templateUrl: 'views/signMessage.html'
}
}
})
.state('tabs.verifyMessage', {
url: '/verifyMessage',
views: {
'tab-home@tabs': {
controller: 'verifyMessageController',
templateUrl: 'views/verifyMessage.html'
}
}
})
/*
*
* Mercado Libre Gift Card

View file

@ -0,0 +1,37 @@
'use strict';
angular.module('copayApp.services').factory('signVerifyMessageService', function($http, $log, lodash, moment, storageService, configService, platformInfo, servicesService) {
var root = {};
var credentials = {};
var signServicesItem = {
name: 'signMessage',
title: 'Sign Message',
icon: 'icon-sign-message',
sref: 'tabs.signMessage',
};
/*var verifyServicesItem = {
name: 'verifyMessage',
title: 'Verify Message',
icon: 'icon-verify-message',
sref: 'tabs.verifyMessage',
};*/
var register = function() {
servicesService.register(signServicesItem);
//servicesService.register(verifyServicesItem);
};
root.signMessage = function(wallet, message) {
var privKey = wallet.credentials.walletPrivKey;
var coin = wallet.coin;
return wallet.signMessage(message, privKey, coin);
}
root.verifyMessage = function(message, signature, pubKey, coin) {
return wallet.verifyMessage(message, signature, pubKey, coin);
}
register();
return root;
});