mirror of
https://github.com/nextcloud/passman.git
synced 2025-11-09 13:44:40 +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(){
|
$scope.applyShare = function(){
|
||||||
console.log("boom!");
|
console.log("boom!");
|
||||||
var list = $scope.share_settings.credentialSharedWithUserAndGroup;
|
ShareService.generateSharedKey(20).then(function(key){
|
||||||
console.log(list);
|
console.log(key);
|
||||||
for (var i = 0; i < list.length; i++){
|
var list = $scope.share_settings.credentialSharedWithUserAndGroup;
|
||||||
ShareService.getVaultsByUser(list[i].user_id).then(function(data){
|
console.log(list);
|
||||||
console.log(data);
|
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) {
|
getVaultsByUser: function (userId) {
|
||||||
var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/vaults/'+ 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) {
|
if (response.data) {
|
||||||
return response.data;
|
return response.data;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -64,12 +64,13 @@ angular.module('passmanApp')
|
||||||
generateSharedKey: function(size){
|
generateSharedKey: function(size){
|
||||||
size = size || 20;
|
size = size || 20;
|
||||||
return new C_Promise(function(){
|
return new C_Promise(function(){
|
||||||
|
var t = this;
|
||||||
CRYPTO.PASSWORD.generate(size,
|
CRYPTO.PASSWORD.generate(size,
|
||||||
function(pass) {
|
function(pass) {
|
||||||
this.call_then(pass);
|
t.call_then(pass);
|
||||||
},
|
},
|
||||||
function(progress) {
|
function(progress) {
|
||||||
this.call_progress(progress);
|
t.call_progress(progress);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue