mirror of
https://github.com/nextcloud/passman.git
synced 2025-01-11 01:39:56 +08:00
19bcdd91c0
Included Forge lib
34 lines
852 B
JavaScript
34 lines
852 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* @ngdoc service
|
|
* @name passmanApp.ShareService
|
|
* @description
|
|
* # ShareService
|
|
* Service in the passmanApp.
|
|
*/
|
|
angular.module('passmanApp')
|
|
.service('ShareService', ['$http', function ($http) {
|
|
var _tags = [];
|
|
return {
|
|
search: function (string) {
|
|
var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/search');
|
|
return $http.post(queryUrl, {search: string}).then(function (response) {
|
|
if (response.data) {
|
|
return response.data;
|
|
} else {
|
|
return response;
|
|
}
|
|
});
|
|
},
|
|
generateRSAKeys: function(key_length){
|
|
return forge.pki.rsa.generateKeyPair(key_length);
|
|
},
|
|
rsaKeyPairToPEM: function(keypair){
|
|
return {
|
|
'publicKey' : forge.pki.publicKeyToPem(keypair.publicKey),
|
|
'privateKey' : forge.pki.privateKeyToPem(keypair.privateKey)
|
|
};
|
|
}
|
|
}
|
|
}]);
|