@lifeready/core 8.0.2 → 8.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10775,22 +10775,31 @@
10775
10775
  var directoryKey, sharedCipherData, wrappedItemKey;
10776
10776
  return __generator(this, function (_a) {
10777
10777
  switch (_a.label) {
10778
- case 0: return [4 /*yield*/, this.itemService.getDirectoryKey(options.directoryId, options.directoryKeyId)];
10779
- case 1:
10778
+ case 0:
10779
+ if (!(options.accessRole == exports.AccessRoleChoice.DENY)) return [3 /*break*/, 1];
10780
+ // Cryptographic access to item is not required.
10781
+ return [2 /*return*/, {
10782
+ directoryId: options.directoryId,
10783
+ accessRole: options.accessRole,
10784
+ wrappedItemKey: null,
10785
+ sharedCipherData: null,
10786
+ }];
10787
+ case 1: return [4 /*yield*/, this.itemService.getDirectoryKey(options.directoryId, options.directoryKeyId)];
10788
+ case 2:
10780
10789
  directoryKey = _a.sent();
10781
10790
  return [4 /*yield*/, this.keyGraph.encryptToString(receiverSharedKey, options.sharedCipherDataClearJson || '')];
10782
- case 2:
10791
+ case 3:
10783
10792
  sharedCipherData = _a.sent();
10784
10793
  return [4 /*yield*/, this.keyGraph.encryptToString(receiverSharedKey, directoryKey.jwk.toJSON(true))];
10785
- case 3:
10794
+ case 4:
10786
10795
  wrappedItemKey = _a.sent();
10787
10796
  return [4 /*yield*/, this.keyGraph.encryptToString(assemblyKey, wrappedItemKey)];
10788
- case 4:
10797
+ case 5:
10789
10798
  wrappedItemKey = _a.sent();
10790
10799
  return [2 /*return*/, {
10791
10800
  directoryId: options.directoryId,
10792
- wrappedItemKey: wrappedItemKey,
10793
10801
  accessRole: options.accessRole,
10802
+ wrappedItemKey: wrappedItemKey,
10794
10803
  sharedCipherData: sharedCipherData,
10795
10804
  }];
10796
10805
  }
@@ -12055,7 +12064,7 @@
12055
12064
  _b = {
12056
12065
  mutation: CreateDirectoryShareMutation
12057
12066
  };
12058
- return [4 /*yield*/, this.prepareCreateSharedItemMutation(Object.assign(Object.assign({}, options), { isDirectory: true }))];
12067
+ return [4 /*yield*/, this.prepareCreateItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: true }))];
12059
12068
  case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12060
12069
  _b)]))()];
12061
12070
  }
@@ -12079,14 +12088,14 @@
12079
12088
  _b = {
12080
12089
  mutation: CreateFileShareMutation
12081
12090
  };
12082
- return [4 /*yield*/, this.prepareCreateSharedItemMutation(Object.assign(Object.assign({}, options), { isDirectory: false }))];
12091
+ return [4 /*yield*/, this.prepareCreateItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: false }))];
12083
12092
  case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12084
12093
  _b)]))()];
12085
12094
  }
12086
12095
  });
12087
12096
  });
12088
12097
  };
12089
- TrustedPartyService.prototype.prepareCreateSharedItemMutation = function (options) {
12098
+ TrustedPartyService.prototype.prepareCreateItemShareMutation = function (options) {
12090
12099
  return __awaiter(this, void 0, void 0, function () {
12091
12100
  var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, itemKey, wrappingKey, wrappedKey;
12092
12101
  var _this = this;
@@ -12094,13 +12103,11 @@
12094
12103
  switch (_a.label) {
12095
12104
  case 0:
12096
12105
  itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, accessRole = options.accessRole, isDirectory = options.isDirectory, shareType = options.shareType;
12097
- console.log('createSharedItemMutation()', itemKeyId);
12098
12106
  return [4 /*yield*/, this.keyGraph.getKey(itemKeyId, function () { return isDirectory
12099
12107
  ? _this.itemService.getDirectoryKeyId(itemId)
12100
12108
  : _this.itemService.getFileKeyId(itemId); })];
12101
12109
  case 1:
12102
12110
  itemKey = _a.sent();
12103
- console.log('createSharedItemMutation()', itemKey.id);
12104
12111
  return [4 /*yield*/, this.keyGraph.getKey(tpSharedKeyId, function () { return _this.getTpCurrentUserSharedKey(tpId).then(function (res) { return res.sharedKey.id; }); })];
12105
12112
  case 2:
12106
12113
  wrappingKey = _a.sent();
@@ -12134,7 +12141,7 @@
12134
12141
  return __generator(this, function (_a) {
12135
12142
  return [2 /*return*/, new LrMutation({
12136
12143
  mutation: UpdateDirectoryShareMutation,
12137
- variables: this.prepareUpdateSharedItemMutation(options),
12144
+ variables: this.prepareUpdateItemShareMutation(options),
12138
12145
  })];
12139
12146
  });
12140
12147
  });
@@ -12151,16 +12158,16 @@
12151
12158
  return __generator(this, function (_a) {
12152
12159
  return [2 /*return*/, new LrMutation({
12153
12160
  mutation: UpdateFileShareMutation,
12154
- variables: this.prepareUpdateSharedItemMutation(options),
12161
+ variables: this.prepareUpdateItemShareMutation(options),
12155
12162
  })];
12156
12163
  });
12157
12164
  });
12158
12165
  };
12159
- TrustedPartyService.prototype.prepareUpdateSharedItemMutation = function (options) {
12160
- var sharedItemId = options.sharedItemId, accessRole = options.accessRole;
12166
+ TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
12167
+ var itemShareId = options.itemShareId, accessRole = options.accessRole;
12161
12168
  return {
12162
12169
  input: {
12163
- id: sharedItemId,
12170
+ id: itemShareId,
12164
12171
  accessRole: accessRole,
12165
12172
  },
12166
12173
  };
@@ -12203,7 +12210,7 @@
12203
12210
  _b = {
12204
12211
  mutation: CompleteDetachedDirectoryShareMutation
12205
12212
  };
12206
- return [4 /*yield*/, this.prepareCompleteDetachedSharedItemMutation(Object.assign(Object.assign({}, options), { isDirectory: true }))];
12213
+ return [4 /*yield*/, this.prepareCompleteDetachedItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: true }))];
12207
12214
  case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12208
12215
  _b)]))()];
12209
12216
  }
@@ -12227,24 +12234,24 @@
12227
12234
  _b = {
12228
12235
  mutation: CompleteDetachedFileShareMutation
12229
12236
  };
12230
- return [4 /*yield*/, this.prepareCompleteDetachedSharedItemMutation(Object.assign(Object.assign({}, options), { isDirectory: false }))];
12237
+ return [4 /*yield*/, this.prepareCompleteDetachedItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: false }))];
12231
12238
  case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12232
12239
  _b)]))()];
12233
12240
  }
12234
12241
  });
12235
12242
  });
12236
12243
  };
12237
- TrustedPartyService.prototype.prepareCompleteDetachedSharedItemMutation = function (options) {
12244
+ TrustedPartyService.prototype.prepareCompleteDetachedItemShareMutation = function (options) {
12238
12245
  return __awaiter(this, void 0, void 0, function () {
12239
- var sharedItemId, itemKeyId, isDirectory, itemKey, rootKey, wrappedKey;
12246
+ var itemShareId, itemKeyId, isDirectory, itemKey, rootKey, wrappedKey;
12240
12247
  var _this = this;
12241
12248
  return __generator(this, function (_a) {
12242
12249
  switch (_a.label) {
12243
12250
  case 0:
12244
- sharedItemId = options.sharedItemId, itemKeyId = options.itemKeyId, isDirectory = options.isDirectory;
12251
+ itemShareId = options.itemShareId, itemKeyId = options.itemKeyId, isDirectory = options.isDirectory;
12245
12252
  return [4 /*yield*/, this.keyGraph.getKey(itemKeyId, function () { return isDirectory
12246
- ? _this.itemService.getDirectoryKeyIdFromDirectoryShare(sharedItemId)
12247
- : _this.itemService.getFileKeyIdFromFileShare(sharedItemId); })];
12253
+ ? _this.itemService.getDirectoryKeyIdFromDirectoryShare(itemShareId)
12254
+ : _this.itemService.getFileKeyIdFromFileShare(itemShareId); })];
12248
12255
  case 1:
12249
12256
  itemKey = _a.sent();
12250
12257
  rootKey = this.keyService.currentRootKey;
@@ -12253,7 +12260,7 @@
12253
12260
  wrappedKey = _a.sent();
12254
12261
  return [2 /*return*/, {
12255
12262
  input: {
12256
- id: sharedItemId,
12263
+ id: itemShareId,
12257
12264
  keyId: itemKey.id,
12258
12265
  wrappingKeyId: rootKey.id,
12259
12266
  wrappedKey: wrappedKey,