@lifeready/core 8.0.10 → 8.0.12

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('apollo-angular'), require('@dagrejs/graphlib'), require('lodash'), require('node-jose'), require('@aws-amplify/auth/lib-esm/Auth'), require('graphql-tag'), require('moment'), require('@apollo/client/core'), require('@apollo/client/link/context'), require('@apollo/client/link/retry'), require('ngx-cookie-service'), require('graphql/language/printer'), require('@angular/common/http'), require('@aws-amplify/core'), require('@ng-idle/core'), require('@ng-idle/keepalive'), require('slip39'), require('@aws-amplify/auth')) :
3
- typeof define === 'function' && define.amd ? define('@lifeready/core', ['exports', '@angular/core', 'apollo-angular', '@dagrejs/graphlib', 'lodash', 'node-jose', '@aws-amplify/auth/lib-esm/Auth', 'graphql-tag', 'moment', '@apollo/client/core', '@apollo/client/link/context', '@apollo/client/link/retry', 'ngx-cookie-service', 'graphql/language/printer', '@angular/common/http', '@aws-amplify/core', '@ng-idle/core', '@ng-idle/keepalive', 'slip39', '@aws-amplify/auth'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lifeready = global.lifeready || {}, global.lifeready.core = {}), global.ng.core, global['apollo-angular'], global['@dagrejs/graphlib'], global.lodash, global['node-jose'], global['@aws-amplify/auth/lib-esm/Auth'], global['graphql-tag'], global.moment, global['@apollo/client/core'], global['@apollo/client/link/context'], global['@apollo/client/link/retry'], global['ngx-cookie-service'], global['graphql/language/printer'], global.ng.common.http, global['@aws-amplify/core'], global['@ng-idle/core'], global['@ng-idle/keepalive'], global.slip39, global['@aws-amplify/auth']));
5
- }(this, (function (exports, i0, i1, graphlib, _, nodeJose, i4, gql, moment_, core, context, retry, i2, gqlPrinter, i2$1, core$1, i3, i4$1, slip39, Auth) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('apollo-angular'), require('@dagrejs/graphlib'), require('node-jose'), require('@aws-amplify/auth/lib-esm/Auth'), require('graphql-tag'), require('moment'), require('lodash/cloneDeep'), require('lodash/isEqual'), require('lodash/keyBy'), require('lodash/omit'), require('@apollo/client/core'), require('@apollo/client/link/context'), require('@apollo/client/link/retry'), require('ngx-cookie-service'), require('graphql/language/printer'), require('@angular/common/http'), require('@aws-amplify/core'), require('@ng-idle/core'), require('@ng-idle/keepalive'), require('slip39'), require('@aws-amplify/auth')) :
3
+ typeof define === 'function' && define.amd ? define('@lifeready/core', ['exports', '@angular/core', 'apollo-angular', '@dagrejs/graphlib', 'node-jose', '@aws-amplify/auth/lib-esm/Auth', 'graphql-tag', 'moment', 'lodash/cloneDeep', 'lodash/isEqual', 'lodash/keyBy', 'lodash/omit', '@apollo/client/core', '@apollo/client/link/context', '@apollo/client/link/retry', 'ngx-cookie-service', 'graphql/language/printer', '@angular/common/http', '@aws-amplify/core', '@ng-idle/core', '@ng-idle/keepalive', 'slip39', '@aws-amplify/auth'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lifeready = global.lifeready || {}, global.lifeready.core = {}), global.ng.core, global['apollo-angular'], global['@dagrejs/graphlib'], global['node-jose'], global['@aws-amplify/auth/lib-esm/Auth'], global['graphql-tag'], global.moment, global['lodash/cloneDeep'], global['lodash/isEqual'], null, global['lodash/omit'], global['@apollo/client/core'], global['@apollo/client/link/context'], global['@apollo/client/link/retry'], global['ngx-cookie-service'], global['graphql/language/printer'], global.ng.common.http, global['@aws-amplify/core'], global['@ng-idle/core'], global['@ng-idle/keepalive'], global.slip39, global['@aws-amplify/auth']));
5
+ }(this, (function (exports, i0, i1, graphlib, nodeJose, i4, gql, moment_, lodash$1, lodash$2, keyBy, lodash, core, context, retry, i2, gqlPrinter, i2$1, core$1, i3, i4$1, slip39, Auth) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -27,9 +27,11 @@
27
27
  }
28
28
 
29
29
  var graphlib__default = /*#__PURE__*/_interopDefaultLegacy(graphlib);
30
- var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
31
30
  var gql__default = /*#__PURE__*/_interopDefaultLegacy(gql);
32
31
  var moment___namespace = /*#__PURE__*/_interopNamespace(moment_);
32
+ var lodash__default$1 = /*#__PURE__*/_interopDefaultLegacy(lodash$1);
33
+ var lodash__default$2 = /*#__PURE__*/_interopDefaultLegacy(lodash$2);
34
+ var lodash__default = /*#__PURE__*/_interopDefaultLegacy(lodash);
33
35
  var Auth__default = /*#__PURE__*/_interopDefaultLegacy(Auth);
34
36
 
35
37
  /*! *****************************************************************************
@@ -357,6 +359,8 @@
357
359
  PayloadType["UINT_8_ARRAY"] = "UINT_8_ARRAY";
358
360
  })(PayloadType || (PayloadType = {}));
359
361
 
362
+ // This file is in the "lr-lodash" directory so that we can use the barrel file
363
+
360
364
  function handleApolloError(errors) {
361
365
  if (!errors || !errors.length)
362
366
  return;
@@ -364,6 +368,7 @@
364
368
  return new KcError({
365
369
  code: x.extensions && x.extensions.code,
366
370
  source: x.extensions && x.extensions.source,
371
+ data: x.extensions && lodash__default['default'](x.extensions, ['code', 'source']),
367
372
  message: x.message,
368
373
  debug: {
369
374
  locations: x.locations,
@@ -391,6 +396,7 @@
391
396
  this._type = 'KcError';
392
397
  this.code = options.code;
393
398
  this.source = options.source;
399
+ this.data = options.data;
394
400
  this.message = options.message;
395
401
  this.debug = options.debug;
396
402
  }
@@ -1954,7 +1960,7 @@
1954
1960
  }
1955
1961
  var node = {
1956
1962
  type: KeyGraphNodeType.Key,
1957
- data: ___default['default'].cloneDeep(key),
1963
+ data: lodash__default$1['default'](key),
1958
1964
  };
1959
1965
  this.graph.setNode(key.id, node);
1960
1966
  }
@@ -1977,7 +1983,7 @@
1977
1983
  }
1978
1984
  var edge = {
1979
1985
  type: KeyGraphEdgeType.KeyLink,
1980
- data: ___default['default'].cloneDeep(keyLink),
1986
+ data: lodash__default$1['default'](keyLink),
1981
1987
  };
1982
1988
  // Edge goes from wrapping key to wrapped key.
1983
1989
  this.graph.setEdge(keyLink.wrappingKeyId, keyLink.keyId, edge);
@@ -2001,7 +2007,7 @@
2001
2007
  }
2002
2008
  var edge = {
2003
2009
  type: KeyGraphEdgeType.PassKeyLink,
2004
- data: ___default['default'].cloneDeep(passKeyLink),
2010
+ data: lodash__default$1['default'](passKeyLink),
2005
2011
  };
2006
2012
  // Edge goes from wrapping key to wrapped key.
2007
2013
  this.graph.setEdge(passKeyLink.passKeyId, passKeyLink.keyId, edge);
@@ -2971,6 +2977,15 @@
2971
2977
  },
2972
2978
  }),
2973
2979
  ]));
2980
+ this.registerProcessor('SharedScenarioReceiverDirectoryNode', common.series([
2981
+ common.makeDecryptionProcessor({
2982
+ cipherFieldName: 'sharedCipherData',
2983
+ getKeyId: function (_a) {
2984
+ var field = _a.field;
2985
+ return field.sharedKey.id;
2986
+ },
2987
+ }),
2988
+ ]));
2974
2989
  this.registerProcessor('ScenarioReceiverFileNode', common.series([
2975
2990
  common.makeDecryptionProcessor({
2976
2991
  cipherFieldName: 'sharedCipherData',
@@ -2980,6 +2995,15 @@
2980
2995
  },
2981
2996
  }),
2982
2997
  ]));
2998
+ this.registerProcessor('SharedScenarioReceiverFileNode', common.series([
2999
+ common.makeDecryptionProcessor({
3000
+ cipherFieldName: 'sharedCipherData',
3001
+ getKeyId: function (_a) {
3002
+ var field = _a.field;
3003
+ return field.sharedKey.id;
3004
+ },
3005
+ }),
3006
+ ]));
2983
3007
  this.registerProcessor('SharedScenarioReceiverNode', common.series([
2984
3008
  common.makeDecryptionProcessor({
2985
3009
  cipherFieldName: 'sharedCipherData',
@@ -3341,7 +3365,7 @@
3341
3365
  */
3342
3366
  LrMutation.prototype.select = function (fragments) {
3343
3367
  // Don't touch the original
3344
- var mutationDoc = _.cloneDeep(this.mutation);
3368
+ var mutationDoc = lodash__default$1['default'](this.mutation);
3345
3369
  var mutationNode = getMutation(mutationDoc);
3346
3370
  var fragmentMap = {};
3347
3371
  getFragments(fragments).forEach(function (fragment) {
@@ -3577,7 +3601,7 @@
3577
3601
  var fragments = getFragments(mutation);
3578
3602
  mergedFragments = __spread(mergedFragments, _this.renameFragmentDefinitions(fragments, prefix));
3579
3603
  });
3580
- var mergedMutation = _.cloneDeep(lrMergedMutationDoc);
3604
+ var mergedMutation = lodash__default$1['default'](lrMergedMutationDoc);
3581
3605
  var mutationNode = getMutation(mergedMutation);
3582
3606
  // Add in the mutation selections
3583
3607
  mutationNode.selectionSet.selections = selections;
@@ -3617,7 +3641,7 @@
3617
3641
  switch (_a.label) {
3618
3642
  case 0:
3619
3643
  // Make copies to avoid side effect.
3620
- options = _.cloneDeep(options);
3644
+ options = lodash__default$1['default'](options);
3621
3645
  includeKeyGraph = this.isIncludeKeyGraph(options.includeKeyGraph);
3622
3646
  if (includeKeyGraph) {
3623
3647
  operation = getQuery(options.query);
@@ -3677,7 +3701,7 @@
3677
3701
  switch (_a.label) {
3678
3702
  case 0:
3679
3703
  // Make copies to avoid side effect.
3680
- options = Object.assign(Object.assign({}, options), { mutation: _.cloneDeep(options.mutation) });
3704
+ options = Object.assign(Object.assign({}, options), { mutation: lodash__default$1['default'](options.mutation) });
3681
3705
  includeKeyGraph = this.isIncludeKeyGraph(options.includeKeyGraph);
3682
3706
  if (includeKeyGraph) {
3683
3707
  operation = getMutation(options.mutation);
@@ -3711,7 +3735,7 @@
3711
3735
  });
3712
3736
  };
3713
3737
  LrGraphQLService.prototype.statsSnapshot = function () {
3714
- return _.cloneDeep(this.stats);
3738
+ return lodash__default$1['default'](this.stats);
3715
3739
  };
3716
3740
  LrGraphQLService.prototype.addKeys = function (response) {
3717
3741
  if (response.data.keyGraph) {
@@ -6840,10 +6864,26 @@
6840
6864
  // Debug utilities
6841
6865
  // ------------------------------------------------------
6842
6866
  AuthService.prototype.debugLogin = function (username, password) {
6843
- // This will fail if debug is null. But when debug is null, this function
6844
- // should not be called.
6845
- this.kcConfig.debug.username = username;
6846
- return this.debugLoadUser(password);
6867
+ return __awaiter(this, void 0, void 0, function () {
6868
+ return __generator(this, function (_b) {
6869
+ switch (_b.label) {
6870
+ case 0:
6871
+ // This will fail if debug is null. But when debug is null, this function
6872
+ // should not be called.
6873
+ this.kcConfig.debug.username = username;
6874
+ // This mechanism only works in a browser session because it needs to set cookies etc.
6875
+ // But it sets the last_login field for the users which we need in some tests.
6876
+ return [4 /*yield*/, this.http
6877
+ .get(this.kcConfig.authUrl + "debug_only/users/login/?username=" + encodeURIComponent(username))
6878
+ .toPromise()];
6879
+ case 1:
6880
+ // This mechanism only works in a browser session because it needs to set cookies etc.
6881
+ // But it sets the last_login field for the users which we need in some tests.
6882
+ _b.sent();
6883
+ return [2 /*return*/, this.debugLoadUser(password)];
6884
+ }
6885
+ });
6886
+ });
6847
6887
  };
6848
6888
  AuthService.prototype.debugLoadUser = function (password) {
6849
6889
  return __awaiter(this, void 0, void 0, function () {
@@ -9903,7 +9943,7 @@
9903
9943
  oldValue: oldValue.value,
9904
9944
  });
9905
9945
  }
9906
- else if (!___default['default'].isEqual(newValue.value, oldValue.value)) {
9946
+ else if (!lodash__default$2['default'](newValue.value, oldValue.value)) {
9907
9947
  changes.push({
9908
9948
  field: field,
9909
9949
  id: oldValue.id,
@@ -9970,7 +10010,7 @@
9970
10010
  break;
9971
10011
  default: {
9972
10012
  var value = details[change.field];
9973
- if (___default['default'].isEqual(value, change.oldValue)) {
10013
+ if (lodash__default$2['default'](value, change.oldValue)) {
9974
10014
  hasChanged = true;
9975
10015
  details[change.field] = change.newValue;
9976
10016
  }
@@ -10006,7 +10046,7 @@
10006
10046
  property = property || { value: field, hasMultiple: false };
10007
10047
  property.values = property.values || [];
10008
10048
  if (property.values.length === 0 ||
10009
- property.values.every(function (x) { return !___default['default'].isEqual(field, x.value); })) {
10049
+ property.values.every(function (x) { return !lodash__default$2['default'](field, x.value); })) {
10010
10050
  property.values.push({
10011
10051
  id: label + "-" + new Date().getTime(),
10012
10052
  label: label,
@@ -10383,8 +10423,8 @@
10383
10423
  })
10384
10424
  ], exports.ɵm);
10385
10425
 
10386
- var ScenarioQuery = gqlTyped(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n\n # The itemKey is the same as directory.keyId. It's here so we can detect\n # when the directory key has been rotated.\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n\n # The itemKey is the same as file.keyId. It's here so we can detect\n # when the file key has been rotated.\n itemKey {\n id\n }\n file {\n id\n keyId\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"], ["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n\n # The itemKey is the same as directory.keyId. It's here so we can detect\n # when the directory key has been rotated.\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n\n # The itemKey is the same as file.keyId. It's here so we can detect\n # when the file key has been rotated.\n itemKey {\n id\n }\n file {\n id\n keyId\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"])));
10387
- var SharedScenarioQuery = gqlTyped(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n assemblyKeyId\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"], ["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n assemblyKeyId\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"])));
10426
+ var ScenarioQuery = gqlTyped(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n file {\n id\n keyId\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"], ["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n file {\n id\n keyId\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}"])));
10427
+ var SharedScenarioQuery = gqlTyped(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n assemblyKeyId\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"], ["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverItems {\n receiverDirectories {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n assemblyKeyId\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"])));
10388
10428
  var templateObject_1$m, templateObject_2$h;
10389
10429
 
10390
10430
  function throwClaimIdMismatch() {
@@ -10744,6 +10784,7 @@
10744
10784
  createClaimants = _b.sent();
10745
10785
  return [2 /*return*/, {
10746
10786
  enabled: options.enabled,
10787
+ inactiveSeconds: options.inactiveSeconds,
10747
10788
  createAssembly: createAssembly,
10748
10789
  createReceivers: createReceivers,
10749
10790
  createClaimants: createClaimants,
@@ -10846,6 +10887,7 @@
10846
10887
  return [2 /*return*/, {
10847
10888
  scenarioId: options.scenarioId,
10848
10889
  enabled: options.enabled,
10890
+ inactiveSeconds: options.inactiveSeconds,
10849
10891
  updateAssembly: updateAssembly,
10850
10892
  createReceivers: createReceivers,
10851
10893
  updateReceivers: updateReceivers,
@@ -11195,50 +11237,40 @@
11195
11237
  });
11196
11238
  });
11197
11239
  };
11198
- ScenarioService.prototype.prepareReceiveClaim = function (scenarioId, sharedClaimId) {
11199
- return __awaiter(this, void 0, void 0, function () {
11200
- var sharedScenario, approvals, assemblyKey, receiverDirectories;
11201
- var _this = this;
11202
- return __generator(this, function (_a) {
11203
- switch (_a.label) {
11204
- case 0: return [4 /*yield*/, this.getSharedScenario(scenarioId, sharedClaimId)];
11205
- case 1:
11206
- sharedScenario = (_a.sent()).sharedScenario;
11207
- if (sharedScenario.state !== exports.ScenarioState.APPROVED) {
11208
- throwClaimNotApproved();
11209
- }
11210
- approvals = mapEdges(sharedScenario.sharedClaim.asClaimReceiver.approvals);
11211
- return [4 /*yield*/, this.recoverAssemblyKey(approvals)];
11212
- case 2:
11213
- assemblyKey = _a.sent();
11214
- return [4 /*yield*/, Promise.all(sharedScenario.asReceiver.receiverItems.receiverDirectories.edges
11215
- .map(function (edge) { return edge.node; })
11216
- .map(function (receiverDirectory) { return __awaiter(_this, void 0, void 0, function () {
11217
- var wrappedItemKey;
11218
- return __generator(this, function (_a) {
11219
- switch (_a.label) {
11220
- case 0: return [4 /*yield*/, this.encryptionService.decrypt(assemblyKey, receiverDirectory.wrappedItemKey)];
11221
- case 1:
11222
- wrappedItemKey = _a.sent();
11223
- return [2 /*return*/, {
11224
- receiverDirectoryId: receiverDirectory.id,
11225
- // Looks like receiverDirectory.wrappedItemKey has no other content in side it except a wrapped key.
11226
- // So we can turn this in to a doubly wrapped key and just release the assembly key.
11227
- receiverSharedKeyWrappedItemKey: wrappedItemKey,
11228
- }];
11229
- }
11230
- });
11231
- }); }))];
11232
- case 3:
11233
- receiverDirectories = _a.sent();
11234
- return [2 /*return*/, {
11235
- scenarioClaimId: sharedClaimId,
11236
- receiverDirectories: receiverDirectories,
11237
- }];
11238
- }
11239
- });
11240
- });
11241
- };
11240
+ // async prepareReceiveClaim(scenarioId: string, sharedClaimId: string) {
11241
+ // // Get all the shared items
11242
+ // const sharedScenario = (
11243
+ // await this.getSharedScenario(scenarioId, sharedClaimId)
11244
+ // ).sharedScenario;
11245
+ // if (sharedScenario.state !== ScenarioState.APPROVED) {
11246
+ // throwClaimNotApproved();
11247
+ // }
11248
+ // const approvals = mapEdges(
11249
+ // sharedScenario.sharedClaim.asClaimReceiver.approvals
11250
+ // );
11251
+ // const assemblyKey = await this.recoverAssemblyKey(approvals);
11252
+ // // Decrypt all items
11253
+ // const receiverDirectories = await Promise.all(
11254
+ // sharedScenario.asReceiver.receiverItems.receiverDirectories.edges
11255
+ // .map((edge) => edge.node)
11256
+ // .map(async (receiverDirectory) => {
11257
+ // const wrappedItemKey = await this.encryptionService.decrypt(
11258
+ // assemblyKey,
11259
+ // receiverDirectory.wrappedItemKey
11260
+ // );
11261
+ // return {
11262
+ // receiverDirectoryId: receiverDirectory.id,
11263
+ // // Looks like receiverDirectory.wrappedItemKey has no other content in side it except a wrapped key.
11264
+ // // So we can turn this in to a doubly wrapped key and just release the assembly key.
11265
+ // receiverSharedKeyWrappedItemKey: wrappedItemKey, // the wrappedItemKey is already wrapped by receiverSharedKey
11266
+ // };
11267
+ // })
11268
+ // );
11269
+ // return {
11270
+ // scenarioClaimId: sharedClaimId,
11271
+ // receiverDirectories,
11272
+ // };
11273
+ // }
11242
11274
  ScenarioService.prototype.recoverAssemblyKey = function (approvals) {
11243
11275
  return __awaiter(this, void 0, void 0, function () {
11244
11276
  var partials;