@lifeready/core 1.1.16 → 1.1.18

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.
@@ -5409,6 +5409,10 @@
5409
5409
  { type: IdleService }
5410
5410
  ]; };
5411
5411
 
5412
+ var TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH = 32;
5413
+ var TP_PASSWORD_RESET_SLIP39_PASSPHRASE = 'lifeready';
5414
+ var TP_PASSWORD_RESET_USERNAME_SUFFIX = '.tp_password_reset';
5415
+
5412
5416
  var SecretShare = /** @class */ (function () {
5413
5417
  function SecretShare(assembly, subAssembly, mnemonics) {
5414
5418
  if (assembly === void 0) { assembly = 0; }
@@ -5632,10 +5636,6 @@
5632
5636
  },] }
5633
5637
  ];
5634
5638
 
5635
- var TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH = 32;
5636
- var TP_PASSWORD_RESET_SLIP39_PASSPHRASE = 'lifeready';
5637
- var TP_PASSWORD_RESET_USERNAME_SUFFIX = '.tp_password_reset';
5638
-
5639
5639
  var TpsKeysQuery = gqlTyped(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\nquery TpsKeysQuery($ids: [ID]) {\n tps(id_In: $ids) {\n edges {\n node {\n id\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n }\n }\n }\n }\n }\n}"], ["\nquery TpsKeysQuery($ids: [ID]) {\n tps(id_In: $ids) {\n edges {\n node {\n id\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n }\n }\n }\n }\n }\n}"])));
5640
5640
  var templateObject_1$9;
5641
5641
 
@@ -6137,7 +6137,7 @@
6137
6137
  return TpAssemblyController;
6138
6138
  }());
6139
6139
 
6140
- exports.ɵj = /** @class */ (function (_super) {
6140
+ exports.ɵi = /** @class */ (function (_super) {
6141
6141
  __extends(TpPasswordResetAssemblyController, _super);
6142
6142
  function TpPasswordResetAssemblyController(ngZone, injector) {
6143
6143
  var _this = _super.call(this, injector) || this;
@@ -6151,21 +6151,21 @@
6151
6151
  };
6152
6152
  return TpPasswordResetAssemblyController;
6153
6153
  }(TpAssemblyController));
6154
- exports.ɵj.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetAssemblyController_Factory() { return new exports.ɵj(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR)); }, token: exports.ɵj, providedIn: "root" });
6155
- exports.ɵj.decorators = [
6154
+ exports.ɵi.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetAssemblyController_Factory() { return new exports.ɵi(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR)); }, token: exports.ɵi, providedIn: "root" });
6155
+ exports.ɵi.decorators = [
6156
6156
  { type: i0.Injectable, args: [{
6157
6157
  providedIn: 'root',
6158
6158
  },] }
6159
6159
  ];
6160
- exports.ɵj.ctorParameters = function () { return [
6160
+ exports.ɵi.ctorParameters = function () { return [
6161
6161
  { type: i0.NgZone },
6162
6162
  { type: i0.Injector }
6163
6163
  ]; };
6164
- exports.ɵj = __decorate([
6164
+ exports.ɵi = __decorate([
6165
6165
  RunOutsideAngular({
6166
6166
  ngZoneName: 'ngZone',
6167
6167
  })
6168
- ], exports.ɵj);
6168
+ ], exports.ɵi);
6169
6169
 
6170
6170
  var CancelTpPasswordResetRequestMutation = gqlTyped(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\nmutation CancelTpPasswordResetRequestMutation {\n cancelTpPasswordResetRequest(input: {}) {\n id\n }\n}"], ["\nmutation CancelTpPasswordResetRequestMutation {\n cancelTpPasswordResetRequest(input: {}) {\n id\n }\n}"])));
6171
6171
  var CreateTpAssemblyKeyChallengeMutation = gqlTyped(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\nmutation CreateTpAssemblyKeyChallengeMutation(\n $input: CreateTpAssemblyKeyChallengeInput!\n) {\n createTpAssemblyKeyChallenge(input: $input) {\n challenge\n }\n}"], ["\nmutation CreateTpAssemblyKeyChallengeMutation(\n $input: CreateTpAssemblyKeyChallengeInput!\n) {\n createTpAssemblyKeyChallenge(input: $input) {\n challenge\n }\n}"])));
@@ -6193,7 +6193,7 @@
6193
6193
  return function () { return authService.initialise(); };
6194
6194
  };
6195
6195
  var LifeReadyAuthService = /** @class */ (function () {
6196
- function LifeReadyAuthService(config, auth, keyFactory, keyService, profileService, keyGraphService, passwordService, idleService, lrGraphQL, tpPasswordResetProcessorService, persistService, encryptionService, slip39Service, assemblyController) {
6196
+ function LifeReadyAuthService(config, auth, keyFactory, keyService, profileService, keyGraphService, passwordService, idleService, lrGraphQL, tpPasswordResetProcessorService, persistService, encryptionService, assemblyController) {
6197
6197
  this.config = config;
6198
6198
  this.auth = auth;
6199
6199
  this.keyFactory = keyFactory;
@@ -6206,7 +6206,6 @@
6206
6206
  this.tpPasswordResetProcessorService = tpPasswordResetProcessorService;
6207
6207
  this.persistService = persistService;
6208
6208
  this.encryptionService = encryptionService;
6209
- this.slip39Service = slip39Service;
6210
6209
  this.assemblyController = assemblyController;
6211
6210
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6212
6211
  this.hubSubject = new rxjs.ReplaySubject(1);
@@ -6846,7 +6845,7 @@
6846
6845
  };
6847
6846
  return LifeReadyAuthService;
6848
6847
  }());
6849
- LifeReadyAuthService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(i0.ɵɵinject(LR_CONFIG), i0.ɵɵinject(i4.AuthClass), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyService), i0.ɵɵinject(ProfileService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(PasswordService), i0.ɵɵinject(IdleService), i0.ɵɵinject(exports.ɵf), i0.ɵɵinject(exports.ɵg), i0.ɵɵinject(PersistService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(Slip39Service), i0.ɵɵinject(exports.ɵj)); }, token: LifeReadyAuthService, providedIn: "root" });
6848
+ LifeReadyAuthService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(i0.ɵɵinject(LR_CONFIG), i0.ɵɵinject(i4.AuthClass), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyService), i0.ɵɵinject(ProfileService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(PasswordService), i0.ɵɵinject(IdleService), i0.ɵɵinject(exports.ɵf), i0.ɵɵinject(exports.ɵg), i0.ɵɵinject(PersistService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(exports.ɵi)); }, token: LifeReadyAuthService, providedIn: "root" });
6850
6849
  LifeReadyAuthService.decorators = [
6851
6850
  { type: i0.Injectable, args: [{
6852
6851
  providedIn: 'root',
@@ -6865,8 +6864,7 @@
6865
6864
  { type: exports.ɵg },
6866
6865
  { type: PersistService },
6867
6866
  { type: EncryptionService },
6868
- { type: Slip39Service },
6869
- { type: exports.ɵj }
6867
+ { type: exports.ɵi }
6870
6868
  ]; };
6871
6869
 
6872
6870
  (function (FileType) {
@@ -12862,7 +12860,7 @@
12862
12860
 
12863
12861
  var SCENARIO_SLIP39_PASSPHRASE = 'lifeready';
12864
12862
 
12865
- exports.ɵo = /** @class */ (function (_super) {
12863
+ exports.ɵn = /** @class */ (function (_super) {
12866
12864
  __extends(ScenarioAssemblyController, _super);
12867
12865
  function ScenarioAssemblyController(ngZone, injector) {
12868
12866
  var _this = _super.call(this, injector) || this;
@@ -12876,21 +12874,21 @@
12876
12874
  };
12877
12875
  return ScenarioAssemblyController;
12878
12876
  }(TpAssemblyController));
12879
- exports.ɵo.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScenarioAssemblyController_Factory() { return new exports.ɵo(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR)); }, token: exports.ɵo, providedIn: "root" });
12880
- exports.ɵo.decorators = [
12877
+ exports.ɵn.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScenarioAssemblyController_Factory() { return new exports.ɵn(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR)); }, token: exports.ɵn, providedIn: "root" });
12878
+ exports.ɵn.decorators = [
12881
12879
  { type: i0.Injectable, args: [{
12882
12880
  providedIn: 'root',
12883
12881
  },] }
12884
12882
  ];
12885
- exports.ɵo.ctorParameters = function () { return [
12883
+ exports.ɵn.ctorParameters = function () { return [
12886
12884
  { type: i0.NgZone },
12887
12885
  { type: i0.Injector }
12888
12886
  ]; };
12889
- exports.ɵo = __decorate([
12887
+ exports.ɵn = __decorate([
12890
12888
  RunOutsideAngular({
12891
12889
  ngZoneName: 'ngZone',
12892
12890
  })
12893
- ], exports.ɵo);
12891
+ ], exports.ɵn);
12894
12892
 
12895
12893
  var CreateScenarioMutation = gqlTyped(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"], ["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"])));
12896
12894
  var UpdateScenarioMutation = gqlTyped(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"], ["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"])));
@@ -13732,7 +13730,7 @@
13732
13730
  return ScenarioService;
13733
13731
  }(LrService));
13734
13732
  exports.ScenarioService.SLIP39_PASSPHRASE = 'lifeready';
13735
- exports.ScenarioService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScenarioService_Factory() { return new exports.ScenarioService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(exports.Item2Service), i0.ɵɵinject(exports.ɵo), i0.ɵɵinject(EncryptionService)); }, token: exports.ScenarioService, providedIn: "root" });
13733
+ exports.ScenarioService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScenarioService_Factory() { return new exports.ScenarioService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(exports.Item2Service), i0.ɵɵinject(exports.ɵn), i0.ɵɵinject(EncryptionService)); }, token: exports.ScenarioService, providedIn: "root" });
13736
13734
  exports.ScenarioService.decorators = [
13737
13735
  { type: i0.Injectable, args: [{
13738
13736
  providedIn: 'root',
@@ -13743,7 +13741,7 @@
13743
13741
  { type: i0.Injector },
13744
13742
  { type: KeyGraphService },
13745
13743
  { type: exports.Item2Service },
13746
- { type: exports.ɵo },
13744
+ { type: exports.ɵn },
13747
13745
  { type: EncryptionService }
13748
13746
  ]; };
13749
13747
  exports.ScenarioService = __decorate([
@@ -13962,7 +13960,7 @@
13962
13960
  })
13963
13961
  ], exports.SharedContactCard2Service);
13964
13962
 
13965
- exports.ɵp = /** @class */ (function (_super) {
13963
+ exports.ɵo = /** @class */ (function (_super) {
13966
13964
  __extends(TpPasswordResetPrivateService, _super);
13967
13965
  function TpPasswordResetPrivateService(ngZone, injector) {
13968
13966
  var _this = _super.call(this, injector) || this;
@@ -14011,21 +14009,21 @@
14011
14009
  };
14012
14010
  return TpPasswordResetPrivateService;
14013
14011
  }(LrService));
14014
- exports.ɵp.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetPrivateService_Factory() { return new exports.ɵp(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR)); }, token: exports.ɵp, providedIn: "root" });
14015
- exports.ɵp.decorators = [
14012
+ exports.ɵo.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetPrivateService_Factory() { return new exports.ɵo(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR)); }, token: exports.ɵo, providedIn: "root" });
14013
+ exports.ɵo.decorators = [
14016
14014
  { type: i0.Injectable, args: [{
14017
14015
  providedIn: 'root',
14018
14016
  },] }
14019
14017
  ];
14020
- exports.ɵp.ctorParameters = function () { return [
14018
+ exports.ɵo.ctorParameters = function () { return [
14021
14019
  { type: i0.NgZone },
14022
14020
  { type: i0.Injector }
14023
14021
  ]; };
14024
- exports.ɵp = __decorate([
14022
+ exports.ɵo = __decorate([
14025
14023
  RunOutsideAngular({
14026
14024
  ngZoneName: 'ngZone',
14027
14025
  })
14028
- ], exports.ɵp);
14026
+ ], exports.ɵo);
14029
14027
 
14030
14028
  exports.TpPasswordResetRequestService = /** @class */ (function (_super) {
14031
14029
  __extends(TpPasswordResetRequestService, _super);
@@ -14141,7 +14139,7 @@
14141
14139
  };
14142
14140
  return TpPasswordResetRequestService;
14143
14141
  }(LrService));
14144
- exports.TpPasswordResetRequestService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetRequestService_Factory() { return new exports.TpPasswordResetRequestService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(exports.ɵp)); }, token: exports.TpPasswordResetRequestService, providedIn: "root" });
14142
+ exports.TpPasswordResetRequestService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetRequestService_Factory() { return new exports.TpPasswordResetRequestService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(exports.ɵo)); }, token: exports.TpPasswordResetRequestService, providedIn: "root" });
14145
14143
  exports.TpPasswordResetRequestService.decorators = [
14146
14144
  { type: i0.Injectable, args: [{
14147
14145
  providedIn: 'root',
@@ -14151,7 +14149,7 @@
14151
14149
  { type: i0.NgZone },
14152
14150
  { type: i0.Injector },
14153
14151
  { type: EncryptionService },
14154
- { type: exports.ɵp }
14152
+ { type: exports.ɵo }
14155
14153
  ]; };
14156
14154
  exports.TpPasswordResetRequestService = __decorate([
14157
14155
  RunOutsideAngular({
@@ -14159,6 +14157,33 @@
14159
14157
  })
14160
14158
  ], exports.TpPasswordResetRequestService);
14161
14159
 
14160
+ var COGNITO_LOCALSTORAGE_PREFIX = 'CognitoIdentityServiceProvider';
14161
+ /**
14162
+ * Remove all keys in localstorage with matching prefix.
14163
+ * A prefix must be specified. If you want to remove everything, then just use localStorage.clear().
14164
+ *
14165
+ * @param prefix Keys with this prefix will be removed.
14166
+ */
14167
+ function clearLocalStorage(prefix) {
14168
+ if (!prefix) {
14169
+ throw new LrBadArgumentException('You must specify a non empty prefix.');
14170
+ }
14171
+ // Remove all persisted session variables
14172
+ Object.keys(localStorage).forEach(function (key) {
14173
+ if (key.startsWith(prefix)) {
14174
+ localStorage.removeItem(key);
14175
+ }
14176
+ });
14177
+ }
14178
+ /**
14179
+ * Clear all items related to cognito in localstorage.
14180
+ * The remember device function sometimes interferes with creating new users
14181
+ * on TP based password reset.
14182
+ */
14183
+ function clearCognitoLocalStorage() {
14184
+ clearLocalStorage(COGNITO_LOCALSTORAGE_PREFIX);
14185
+ }
14186
+
14162
14187
  exports.TpPasswordResetUserService = /** @class */ (function (_super) {
14163
14188
  __extends(TpPasswordResetUserService, _super);
14164
14189
  function TpPasswordResetUserService(ngZone, injector, config, keyFactory, encryptionService, passwordService, http, auth) {
@@ -14210,7 +14235,11 @@
14210
14235
  var passKeyBundle, masterKey, wrappedMasterKey, prk, masterKeyWrappedPrk, requestResetResult, signUpResult;
14211
14236
  return __generator(this, function (_a) {
14212
14237
  switch (_a.label) {
14213
- case 0: return [4 /*yield*/, this.passwordService.createPassKeyBundle(password)];
14238
+ case 0:
14239
+ // Clearing all localstorage data because cognito has the "remember device" functionality which sometimes
14240
+ // does not work properly. Clearing localstorage seems to solve this issue.
14241
+ clearCognitoLocalStorage();
14242
+ return [4 /*yield*/, this.passwordService.createPassKeyBundle(password)];
14214
14243
  case 1:
14215
14244
  passKeyBundle = _a.sent();
14216
14245
  return [4 /*yield*/, this.keyFactory.createKey()];
@@ -14386,7 +14415,7 @@
14386
14415
  };
14387
14416
  return TpPasswordResetService;
14388
14417
  }(LrService));
14389
- exports.TpPasswordResetService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetService_Factory() { return new exports.TpPasswordResetService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(exports.ɵp), i0.ɵɵinject(exports.ɵj)); }, token: exports.TpPasswordResetService, providedIn: "root" });
14418
+ exports.TpPasswordResetService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetService_Factory() { return new exports.TpPasswordResetService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(exports.ɵo), i0.ɵɵinject(exports.ɵi)); }, token: exports.TpPasswordResetService, providedIn: "root" });
14390
14419
  exports.TpPasswordResetService.decorators = [
14391
14420
  { type: i0.Injectable, args: [{
14392
14421
  providedIn: 'root',
@@ -14395,8 +14424,8 @@
14395
14424
  exports.TpPasswordResetService.ctorParameters = function () { return [
14396
14425
  { type: i0.NgZone },
14397
14426
  { type: i0.Injector },
14398
- { type: exports.ɵp },
14399
- { type: exports.ɵj }
14427
+ { type: exports.ɵo },
14428
+ { type: exports.ɵi }
14400
14429
  ]; };
14401
14430
  exports.TpPasswordResetService = __decorate([
14402
14431
  RunOutsideAngular({
@@ -15022,11 +15051,10 @@
15022
15051
  exports.ɵd = KeyFactoryService;
15023
15052
  exports.ɵe = KeyMetaService;
15024
15053
  exports.ɵh = RunOutsideAngular;
15025
- exports.ɵi = Slip39Service;
15026
- exports.ɵk = TpAssemblyController;
15027
- exports.ɵl = LrService;
15028
- exports.ɵm = SharedContactCardService;
15029
- exports.ɵn = TrustedPartyService;
15054
+ exports.ɵj = TpAssemblyController;
15055
+ exports.ɵk = LrService;
15056
+ exports.ɵl = SharedContactCardService;
15057
+ exports.ɵm = TrustedPartyService;
15030
15058
 
15031
15059
  Object.defineProperty(exports, '__esModule', { value: true });
15032
15060