Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 3x 3x 3x 3x 3x 3x 3x | "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShareService = void 0; const Credential_1 = __importDefault(require("../Model/Credential")); const SharingACL_1 = require("../Model/SharingACL"); class ShareService { static async getCredentialsSharedWithUs(vault, server, getCachedIfPossible = false) { let sharedItemsResponse = await server.getJson('/sharing/vault/' + vault.guid + '/get', (response) => { server.logger.onError(response.message); }, getCachedIfPossible); const credentials = []; if (sharedItemsResponse) { for (const sharedItem of sharedItemsResponse) { try { const sharedCredential = Credential_1.default.fromData(sharedItem.credential_data, vault, server); sharedCredential.encryptedSharedCredentialEncryptionKey = sharedItem.shared_key; // transfer acl data from sharedItem into the new Credential object delete sharedItem.credential_data; const permissionsSharingAcl = new SharingACL_1.SharingACL(sharedItem.permissions); const newAcl = sharedItem; newAcl.permissions = permissionsSharingAcl; sharedCredential.acl = newAcl; credentials.push(sharedCredential); } catch (e) { server.logger.anyError(e); server.logger.onError('Failed to decrypt shared credential: ' + sharedItem.credential_data.label); } } } return credentials; } /** * Response array entries of ICredentialShareRequest does not contain the credential_data field. * * @param vault * @param server */ static getACLsForCredentialsSharedWithUs(vault, server) { return server.getJson('/sharing/vault/' + vault.guid + '/acl', (response) => { server.logger.onError(response.message); }); } static updateSharedKeyForCredentialSharedWithUsByGuid(encryptedSharedKey, credentialGUID, server) { return server.postJson('/sharing/credential/' + credentialGUID + '/acl/shared_key', { shared_key: encryptedSharedKey }, () => { }, 'PATCH'); } } exports.ShareService = ShareService; |