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', - '
{{active_vault}}'); + '
'); }]); angular.module('views/partials/forms/settings/tool.html', []).run(['$templateCache', function($templateCache) { diff --git a/lib/Db/Vault.php b/lib/Db/Vault.php index fc33d60b..4a43ff11 100644 --- a/lib/Db/Vault.php +++ b/lib/Db/Vault.php @@ -50,6 +50,7 @@ class Vault extends Entity implements \JsonSerializable{ // add types in constructor $this->addType('created', 'integer'); $this->addType('lastAccess', 'integer'); + $this->addType('sharing_keys_generated', 'integer'); } /** * Turns entity attributes into an array diff --git a/templates/views/partials/forms/settings/sharing.html b/templates/views/partials/forms/settings/sharing.html index 05a981e7..b21bdc93 100644 --- a/templates/views/partials/forms/settings/sharing.html +++ b/templates/views/partials/forms/settings/sharing.html @@ -3,11 +3,11 @@
- +
- +
@@ -24,5 +24,4 @@
- -{{active_vault}} \ No newline at end of file + \ No newline at end of file