diff --git a/js/app/controllers/share_settings.js b/js/app/controllers/share_settings.js index 789b3dbe..1425bff5 100644 --- a/js/app/controllers/share_settings.js +++ b/js/app/controllers/share_settings.js @@ -8,6 +8,8 @@ angular.module('passmanApp') $scope.progress = 1; $scope.generating = false; + $scope.sharing_keys = ShareService.getSharingKeys(); + $scope.generateKeys = function (length) { $scope.progress = 1; $scope.generating = true; @@ -27,7 +29,6 @@ angular.module('passmanApp') 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') }) diff --git a/js/app/services/shareservice.js b/js/app/services/shareservice.js index 73b22737..f8e246ef 100644 --- a/js/app/services/shareservice.js +++ b/js/app/services/shareservice.js @@ -8,8 +8,7 @@ * Service in the passmanApp. */ angular.module('passmanApp') - .service('ShareService', ['$http', function ($http) { - var _tags = []; + .service('ShareService', ['$http', 'VaultService', 'EncryptService', function ($http, VaultService, EncryptService) { return { search: function (string) { var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/search'); @@ -47,6 +46,13 @@ angular.module('passmanApp') 'privateKey' : forge.pki.privateKeyToPem(keypair.privateKey) }; }, + getSharingKeys: function(){ + var vault = VaultService.getActiveVault(); + return{ + 'private_sharing_key': EncryptService.decryptString(angular.copy(vault.private_sharing_key)), + 'public_sharing_key': vault.public_sharing_key + }; + }, rsaPrivateKeyFromPEM: function(private_pem) { return forge.pki.privateKeyFromPem(private_pem); }, diff --git a/js/templates.js b/js/templates.js index 403582b8..fbf0c61b 100644 --- a/js/templates.js +++ b/js/templates.js @@ -63,7 +63,7 @@ angular.module('views/partials/forms/settings/import.html', []).run(['$templateC angular.module('views/partials/forms/settings/sharing.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/partials/forms/settings/sharing.html', - '