mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-11 01:34:12 +08:00
Sharing logic beggins
This commit is contained in:
parent
106cf3bf5b
commit
ad3dcb4b26
2 changed files with 23 additions and 10 deletions
|
@ -101,12 +101,24 @@ angular.module('passmanApp')
|
|||
|
||||
$scope.applyShare = function(){
|
||||
console.log("boom!");
|
||||
var list = $scope.share_settings.credentialSharedWithUserAndGroup;
|
||||
console.log(list);
|
||||
for (var i = 0; i < list.length; i++){
|
||||
ShareService.getVaultsByUser(list[i].user_id).then(function(data){
|
||||
console.log(data);
|
||||
})
|
||||
}
|
||||
ShareService.generateSharedKey(20).then(function(key){
|
||||
console.log(key);
|
||||
var list = $scope.share_settings.credentialSharedWithUserAndGroup;
|
||||
console.log(list);
|
||||
for (var i = 0; i < list.length; i++){
|
||||
ShareService.getVaultsByUser(list[i].userId).then(function(data){
|
||||
console.log(data);
|
||||
for (var x = 0; x < data.length; x++) {
|
||||
var rsa = ShareService.rsaPublicKeyFromPEM(data[x].public_sharing_key);
|
||||
console.log("parsed RSA public key");
|
||||
var cyphertext = rsa.encrypt(key);
|
||||
console.log(cyphertext);
|
||||
cyphertext= forge.util.encode64(cyphertext);
|
||||
console.log(cyphertext);
|
||||
console.log(cyphertext.length);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}]);
|
||||
|
|
|
@ -27,7 +27,7 @@ angular.module('passmanApp')
|
|||
},
|
||||
getVaultsByUser: function (userId) {
|
||||
var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/vaults/'+ userId);
|
||||
return $http.get(queryUrl, {search: string}).then(function (response) {
|
||||
return $http.get(queryUrl, {search: userId}).then(function (response) {
|
||||
if (response.data) {
|
||||
return response.data;
|
||||
} else {
|
||||
|
@ -64,12 +64,13 @@ angular.module('passmanApp')
|
|||
generateSharedKey: function(size){
|
||||
size = size || 20;
|
||||
return new C_Promise(function(){
|
||||
var t = this;
|
||||
CRYPTO.PASSWORD.generate(size,
|
||||
function(pass) {
|
||||
this.call_then(pass);
|
||||
t.call_then(pass);
|
||||
},
|
||||
function(progress) {
|
||||
this.call_progress(progress);
|
||||
t.call_progress(progress);
|
||||
}
|
||||
);
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue