@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.
@@ -4657,6 +4657,10 @@ PasswordService.ctorParameters = () => [
4657
4657
  { type: IdleService }
4658
4658
  ];
4659
4659
 
4660
+ const TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH = 32;
4661
+ const TP_PASSWORD_RESET_SLIP39_PASSPHRASE = 'lifeready';
4662
+ const TP_PASSWORD_RESET_USERNAME_SUFFIX = '.tp_password_reset';
4663
+
4660
4664
  class SecretShare {
4661
4665
  constructor(assembly = 0, subAssembly = 0, mnemonics = '') {
4662
4666
  this.assembly = assembly;
@@ -4820,10 +4824,6 @@ Slip39Service.decorators = [
4820
4824
  },] }
4821
4825
  ];
4822
4826
 
4823
- const TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH = 32;
4824
- const TP_PASSWORD_RESET_SLIP39_PASSPHRASE = 'lifeready';
4825
- const TP_PASSWORD_RESET_USERNAME_SUFFIX = '.tp_password_reset';
4826
-
4827
4827
  const TpsKeysQuery = gqlTyped `
4828
4828
  query TpsKeysQuery($ids: [ID]) {
4829
4829
  tps(id_In: $ids) {
@@ -5482,7 +5482,7 @@ const initialiseAuth = (authService) => {
5482
5482
  return () => authService.initialise();
5483
5483
  };
5484
5484
  class LifeReadyAuthService {
5485
- constructor(config, auth, keyFactory, keyService, profileService, keyGraphService, passwordService, idleService, lrGraphQL, tpPasswordResetProcessorService, persistService, encryptionService, slip39Service, assemblyController) {
5485
+ constructor(config, auth, keyFactory, keyService, profileService, keyGraphService, passwordService, idleService, lrGraphQL, tpPasswordResetProcessorService, persistService, encryptionService, assemblyController) {
5486
5486
  this.config = config;
5487
5487
  this.auth = auth;
5488
5488
  this.keyFactory = keyFactory;
@@ -5495,7 +5495,6 @@ class LifeReadyAuthService {
5495
5495
  this.tpPasswordResetProcessorService = tpPasswordResetProcessorService;
5496
5496
  this.persistService = persistService;
5497
5497
  this.encryptionService = encryptionService;
5498
- this.slip39Service = slip39Service;
5499
5498
  this.assemblyController = assemblyController;
5500
5499
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5501
5500
  this.hubSubject = new ReplaySubject(1);
@@ -5915,7 +5914,7 @@ class LifeReadyAuthService {
5915
5914
  });
5916
5915
  }
5917
5916
  }
5918
- LifeReadyAuthService.ɵprov = ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(ɵɵinject(LR_CONFIG), ɵɵinject(AuthClass), ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(ProfileService), ɵɵinject(KeyGraphService), ɵɵinject(PasswordService), ɵɵinject(IdleService), ɵɵinject(LrGraphQLService), ɵɵinject(TpPasswordResetProcessorService), ɵɵinject(PersistService), ɵɵinject(EncryptionService), ɵɵinject(Slip39Service), ɵɵinject(TpPasswordResetAssemblyController)); }, token: LifeReadyAuthService, providedIn: "root" });
5917
+ LifeReadyAuthService.ɵprov = ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(ɵɵinject(LR_CONFIG), ɵɵinject(AuthClass), ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(ProfileService), ɵɵinject(KeyGraphService), ɵɵinject(PasswordService), ɵɵinject(IdleService), ɵɵinject(LrGraphQLService), ɵɵinject(TpPasswordResetProcessorService), ɵɵinject(PersistService), ɵɵinject(EncryptionService), ɵɵinject(TpPasswordResetAssemblyController)); }, token: LifeReadyAuthService, providedIn: "root" });
5919
5918
  LifeReadyAuthService.decorators = [
5920
5919
  { type: Injectable, args: [{
5921
5920
  providedIn: 'root',
@@ -5934,7 +5933,6 @@ LifeReadyAuthService.ctorParameters = () => [
5934
5933
  { type: TpPasswordResetProcessorService },
5935
5934
  { type: PersistService },
5936
5935
  { type: EncryptionService },
5937
- { type: Slip39Service },
5938
5936
  { type: TpPasswordResetAssemblyController }
5939
5937
  ];
5940
5938
 
@@ -12141,6 +12139,33 @@ TpPasswordResetRequestService = __decorate([
12141
12139
  })
12142
12140
  ], TpPasswordResetRequestService);
12143
12141
 
12142
+ const COGNITO_LOCALSTORAGE_PREFIX = 'CognitoIdentityServiceProvider';
12143
+ /**
12144
+ * Remove all keys in localstorage with matching prefix.
12145
+ * A prefix must be specified. If you want to remove everything, then just use localStorage.clear().
12146
+ *
12147
+ * @param prefix Keys with this prefix will be removed.
12148
+ */
12149
+ function clearLocalStorage(prefix) {
12150
+ if (!prefix) {
12151
+ throw new LrBadArgumentException('You must specify a non empty prefix.');
12152
+ }
12153
+ // Remove all persisted session variables
12154
+ Object.keys(localStorage).forEach((key) => {
12155
+ if (key.startsWith(prefix)) {
12156
+ localStorage.removeItem(key);
12157
+ }
12158
+ });
12159
+ }
12160
+ /**
12161
+ * Clear all items related to cognito in localstorage.
12162
+ * The remember device function sometimes interferes with creating new users
12163
+ * on TP based password reset.
12164
+ */
12165
+ function clearCognitoLocalStorage() {
12166
+ clearLocalStorage(COGNITO_LOCALSTORAGE_PREFIX);
12167
+ }
12168
+
12144
12169
  let TpPasswordResetUserService = class TpPasswordResetUserService extends LrService {
12145
12170
  constructor(ngZone, injector, config, keyFactory, encryptionService, passwordService, http, auth) {
12146
12171
  super(injector);
@@ -12177,6 +12202,9 @@ let TpPasswordResetUserService = class TpPasswordResetUserService extends LrServ
12177
12202
  }
12178
12203
  requestReset(password, claimId, claimToken) {
12179
12204
  return __awaiter(this, void 0, void 0, function* () {
12205
+ // Clearing all localstorage data because cognito has the "remember device" functionality which sometimes
12206
+ // does not work properly. Clearing localstorage seems to solve this issue.
12207
+ clearCognitoLocalStorage();
12180
12208
  // Generate the key materials
12181
12209
  const passKeyBundle = yield this.passwordService.createPassKeyBundle(password);
12182
12210
  const masterKey = yield this.keyFactory.createKey();
@@ -12704,5 +12732,5 @@ TwoFactorService.ctorParameters = () => [
12704
12732
  * Generated bundle index. Do not edit.
12705
12733
  */
12706
12734
 
12707
- export { AccessLevel, AccessRoleChoice, AccessRoleMethodChoice, ApiContactCard, ApiCurrentUser, ArchiveDirectoryMutation, CancelUserDeleteMutation, Category, CategoryFields, CategoryFilter, CategoryMetaService, CategoryService, ClaimApproverState, ClaimState, CognitoChallengeUser, CommonProcessorsService, CompleteOtkMutation, Config, ContactCard2Service, ContactCardAddress, ContactCardName, CreateCategoryMutation, CreateContactCardMutation$1 as CreateContactCardMutation, CreateFileMutation, CreateFileQuery, CreateLbopQuery, CreateRecordContainerMutation, CreateRecordMutation, CreateVaultMutation, CurrentCategory, CurrentUser, CurrentUserKey, CurrentUserQuery, CurrentUserSharedKeyQuery, DEFAULT_BREADCRUMB_DEPTH, DEFAULT_DESCENDANTS_DEPTH, DefaultCategory, DefaultProcessorOptions, DefaultVaultFilter, DeleteCategoryMutation, DeleteFileMutation, DeleteLbopQuery, DeleteRecordMutation, DirectoryQuery, DirectoryType, FeatureAction, Features, FetchKeyGraphField, FileOperationField, FileQuery, FileType, FileUploadService, GetCategoriesQuery, GetCategoryKeyIdQuery, GetCategoryQuery, GetMySharedCategoriesQuery, GetRecordQuery, GetRootDirectoryIdsQuery, GetTrustedPartyCategoriesQuery, GetVaultsQuery, IdleService, InitiateOtkMutation, Item2Service, KeyExchange2Service, KeyExchangeFields, KeyExchangeMode, KeyExchangeOtkState, KeyExchangeQuery, KeyExchangeService, KeyExchangeState, KeyExchangeTokenQuery, KeyExchangesQuery, KeyGraphField, KeyGraphFragment, LR_CONFIG, LbopQuery, LbopService, LbopsQuery, LifeReadyAuthService, LifeReadyModule, LinkTypeField, LoadedCategoryTree, LockService, LockState, LoginHistoryQuery, LoginResult, LrApiErrorCode, LrApolloService, LrAuthException, LrBadArgumentException, LrBadLogicException, LrBadRequestException, LrBadStateException, LrCodeMismatchException, LrConcurrentAccessException, LrEncryptionException, LrError, LrErrorCode, LrException, LrExpiredCodeException, LrExpiredException, LrGraphQLService, LrLockedException, LrMergedMutation, LrMutation, LrMutationBase, LrNotFoundException, LrRecord, LrService, LrSuspiciousException, LrUnsupportedException, MainContactCard, MainContactCardFields, MainContactCardPlainFields, MainContactCardProperty, MessageService, MoveDirectoryQuery, MoveFileQuery, NewAttachment, NewCategory, NewOrUpdatedAttachment, NewRecord, NotificationService, OtkState, OwnerPlainDataJson, PassIdpApiResult, PasswordChangeStatus, PasswordCheck, PasswordService, PermissionChoice, PersistService, Plan, PlanService, PlanState, ProfileDetailsService, ProfileService, QueryProcessorService, RecordAttachment, RecordAttachmentFilter, RecordAttachmentService, RecordContentFilter, RecordField, RecordFieldType, RecordFilter, RecordService, RecordType, RecordTypeField, RecordTypeFieldOption, RecordTypeService, RecordTypeSummary, RecoveryStatus, RegisterResult, RegisterService, RequestUserDeleteMutation, RespondOtkMutation, RevertFileQuery, ScenarioLastClaimState, ScenarioService, ScenarioState, ServerConfigService, ServerTimeQuery, SharedAccess, SharedContactCard2Service, StripeBillingPortalSession, StripeCheckoutSession, Subscription, TimeService, TpAssemblyState, TpClaimApproverState, TpClaimState, TpPasswordResetRequestService, TpPasswordResetService, TpPasswordResetUserService, TrustedParty2Service, TrustedPartyDetails, TwoFactorService, UnarchiveDirectoryMutation, UpdateCategoryMutation, UpdateContactCardMutation$1 as UpdateContactCardMutation, UpdateFileQuery, UpdateLbopQuery, UpdateRecordContainerMutation, UpdateRecordMutation, UpdatedCategory, UpdatedRecord, UserDeleteState, UserPlan, UserService, UserSharedKeyFields, Vault, VaultCategory, VaultFields, VaultRecord, VaultRecordType, WebCryptoService, awsFetch, configureAmplifyAuth, configureApollo, fragmentSpreadAstSelection, gqlTyped, handleApolloError, handleCognitoCallback, initialiseAuth, mapEdges, mapUserPlans, parentCategoriesField, processConnection, throwClaimIdMismatch, throwClaimNotApproved, ɵ0, KeyGraphService as ɵa, EncryptionService as ɵb, KeyService as ɵc, KeyFactoryService as ɵd, KeyMetaService as ɵe, LrGraphQLService as ɵf, TpPasswordResetProcessorService as ɵg, RunOutsideAngular as ɵh, Slip39Service as ɵi, TpPasswordResetAssemblyController as ɵj, TpAssemblyController as ɵk, LrService as ɵl, SharedContactCardService as ɵm, TrustedPartyService as ɵn, ScenarioAssemblyController as ɵo, TpPasswordResetPrivateService as ɵp };
12735
+ export { AccessLevel, AccessRoleChoice, AccessRoleMethodChoice, ApiContactCard, ApiCurrentUser, ArchiveDirectoryMutation, CancelUserDeleteMutation, Category, CategoryFields, CategoryFilter, CategoryMetaService, CategoryService, ClaimApproverState, ClaimState, CognitoChallengeUser, CommonProcessorsService, CompleteOtkMutation, Config, ContactCard2Service, ContactCardAddress, ContactCardName, CreateCategoryMutation, CreateContactCardMutation$1 as CreateContactCardMutation, CreateFileMutation, CreateFileQuery, CreateLbopQuery, CreateRecordContainerMutation, CreateRecordMutation, CreateVaultMutation, CurrentCategory, CurrentUser, CurrentUserKey, CurrentUserQuery, CurrentUserSharedKeyQuery, DEFAULT_BREADCRUMB_DEPTH, DEFAULT_DESCENDANTS_DEPTH, DefaultCategory, DefaultProcessorOptions, DefaultVaultFilter, DeleteCategoryMutation, DeleteFileMutation, DeleteLbopQuery, DeleteRecordMutation, DirectoryQuery, DirectoryType, FeatureAction, Features, FetchKeyGraphField, FileOperationField, FileQuery, FileType, FileUploadService, GetCategoriesQuery, GetCategoryKeyIdQuery, GetCategoryQuery, GetMySharedCategoriesQuery, GetRecordQuery, GetRootDirectoryIdsQuery, GetTrustedPartyCategoriesQuery, GetVaultsQuery, IdleService, InitiateOtkMutation, Item2Service, KeyExchange2Service, KeyExchangeFields, KeyExchangeMode, KeyExchangeOtkState, KeyExchangeQuery, KeyExchangeService, KeyExchangeState, KeyExchangeTokenQuery, KeyExchangesQuery, KeyGraphField, KeyGraphFragment, LR_CONFIG, LbopQuery, LbopService, LbopsQuery, LifeReadyAuthService, LifeReadyModule, LinkTypeField, LoadedCategoryTree, LockService, LockState, LoginHistoryQuery, LoginResult, LrApiErrorCode, LrApolloService, LrAuthException, LrBadArgumentException, LrBadLogicException, LrBadRequestException, LrBadStateException, LrCodeMismatchException, LrConcurrentAccessException, LrEncryptionException, LrError, LrErrorCode, LrException, LrExpiredCodeException, LrExpiredException, LrGraphQLService, LrLockedException, LrMergedMutation, LrMutation, LrMutationBase, LrNotFoundException, LrRecord, LrService, LrSuspiciousException, LrUnsupportedException, MainContactCard, MainContactCardFields, MainContactCardPlainFields, MainContactCardProperty, MessageService, MoveDirectoryQuery, MoveFileQuery, NewAttachment, NewCategory, NewOrUpdatedAttachment, NewRecord, NotificationService, OtkState, OwnerPlainDataJson, PassIdpApiResult, PasswordChangeStatus, PasswordCheck, PasswordService, PermissionChoice, PersistService, Plan, PlanService, PlanState, ProfileDetailsService, ProfileService, QueryProcessorService, RecordAttachment, RecordAttachmentFilter, RecordAttachmentService, RecordContentFilter, RecordField, RecordFieldType, RecordFilter, RecordService, RecordType, RecordTypeField, RecordTypeFieldOption, RecordTypeService, RecordTypeSummary, RecoveryStatus, RegisterResult, RegisterService, RequestUserDeleteMutation, RespondOtkMutation, RevertFileQuery, ScenarioLastClaimState, ScenarioService, ScenarioState, ServerConfigService, ServerTimeQuery, SharedAccess, SharedContactCard2Service, StripeBillingPortalSession, StripeCheckoutSession, Subscription, TimeService, TpAssemblyState, TpClaimApproverState, TpClaimState, TpPasswordResetRequestService, TpPasswordResetService, TpPasswordResetUserService, TrustedParty2Service, TrustedPartyDetails, TwoFactorService, UnarchiveDirectoryMutation, UpdateCategoryMutation, UpdateContactCardMutation$1 as UpdateContactCardMutation, UpdateFileQuery, UpdateLbopQuery, UpdateRecordContainerMutation, UpdateRecordMutation, UpdatedCategory, UpdatedRecord, UserDeleteState, UserPlan, UserService, UserSharedKeyFields, Vault, VaultCategory, VaultFields, VaultRecord, VaultRecordType, WebCryptoService, awsFetch, configureAmplifyAuth, configureApollo, fragmentSpreadAstSelection, gqlTyped, handleApolloError, handleCognitoCallback, initialiseAuth, mapEdges, mapUserPlans, parentCategoriesField, processConnection, throwClaimIdMismatch, throwClaimNotApproved, ɵ0, KeyGraphService as ɵa, EncryptionService as ɵb, KeyService as ɵc, KeyFactoryService as ɵd, KeyMetaService as ɵe, LrGraphQLService as ɵf, TpPasswordResetProcessorService as ɵg, RunOutsideAngular as ɵh, TpPasswordResetAssemblyController as ɵi, TpAssemblyController as ɵj, LrService as ɵk, SharedContactCardService as ɵl, TrustedPartyService as ɵm, ScenarioAssemblyController as ɵn, TpPasswordResetPrivateService as ɵo };
12708
12736
  //# sourceMappingURL=lifeready-core.js.map