From d54fc74321b5df16b51e499a9539bb77cd6329b3 Mon Sep 17 00:00:00 2001 From: brantje Date: Sun, 25 Sep 2016 21:33:04 +0200 Subject: [PATCH] Encrypt sharing keys --- js/app/controllers/share_settings.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/app/controllers/share_settings.js b/js/app/controllers/share_settings.js index 689df1ce..789b3dbe 100644 --- a/js/app/controllers/share_settings.js +++ b/js/app/controllers/share_settings.js @@ -2,8 +2,8 @@ * Created by wolfi on 25/09/16. */ angular.module('passmanApp') - .controller('SharingSettingsCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', - function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService) { + .controller('SharingSettingsCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'EncryptService', + function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, EncryptService) { $scope.active_vault = VaultService.getActiveVault(); $scope.progress = 1; $scope.generating = false; @@ -24,7 +24,11 @@ angular.module('passmanApp') $scope.active_vault.private_sharing_key = pem.privateKey; $scope.active_vault.public_sharing_key = pem.publicKey; - VaultService.updateSharingKeys($scope.active_vault).then(function (result) { + + var _vault = angular.copy($scope.active_vault); + _vault.private_sharing_key = EncryptService.encryptString(_vault.private_sharing_key); + _vault.public_sharing_key = EncryptService.encryptString(_vault.public_sharing_key); + VaultService.updateSharingKeys(_vault).then(function (result) { console.log('done') }) });