* Remove derived state from state classes
* Create provider for derived state
Derived state is automatically stored to memory storage, but can be derived from any observable.
* Fixup state provider method definitions
* Test `DefaultDerivedState`
* remove implementation notes
* Write docs for derived state
* fixup derived state provider types
* Implement buffered delayUntil operator
* Move state types to a common module
* Move mock ports to centra location
* Alias DerivedStateDependency type
* Add dependencies to browser
* Prefer internal rxjs operators for ref counting
* WIP
* Ensure complete on subjects
* Foreground/background messaging for browser
Defers work for browser to the background
* Test foreground port behaviors
* Inject foreground and background derived state services
* remove unnecessary class field
* Adhere to required options
* Add dderived state to CLI
* Prefer type definition in type parameters to options
* Prefer instance method
* Implements factory methods for common uses
* Remove nothing test
* Remove share subject reference
Share manages connector subjects internally and will reuse them until
refcount is 0 and the cleanup time has passed. Saving our own reference
just risks memory leaks without real testability benefits.
* Fix interaction state
* [deps] Tools: Update electron to v28
* Update electron-builder 27.2.0 to 28.1.0
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* PM-3859 - Desktop App Comp - Build lock mechanism for update app menu which doesn't try to update the menu for users who are being logged out which was causing errors (primary scenario was triggered by logging in on desktop with a TDE user w/out a MP, triggering a sync, then hitting the command to lock the vault right after which would trigger a log out while the sync was still in process. Then, while the log out was in process, the sync would try and trigger an update to the app menu but it would error as some of the user's state had already been cleaned up)
* PM-3859 - App comp - remove use of promise.all to prevent any race conditions from causing intermittent logout errors with state being cleared and then values trying to be set on the cleared state (I observed setMasterKey get called after state account.keys was cleared - received error when attempting to set value on undefined).
* PM-3859 - Desktop Vault Items Component - on log out, if you were on the vault screen, the loss of focus on the vault search text box would trigger a search 200 ms after log out had been triggered. This would eventually attempt to set an undefined master key (VaultItemsComponent.doSearch() --> cipherService.getAllDecrypted() --> cryptoService.getUserKeyWithLegacySupport() --> cryptoService.getMasterKey() --> cryptoService.setMasterKey()). However, at this point, the account had been cleared as part of the log out process and an error would be thrown in the state service for trying to set account.keys.masterKey to undefined when the account and account.keys were undefined. These changes prevent the search from firing until the value changes and also prevents setMasterKey from being called if it is undefined.
* feat: add missing tests for `isFido2FeatureEnabled`
* feat: add user logged in check
* chore: rewrite with cartesian product
* chore: remove test
The test was more complex than the actual function, removing.
* feat: add domain exclusion
* feat: add origin equal vault case
* chore: clean up the old code from `content-secript`
* feat: return early to avoid making api calls
* fix: prettier linting
* fix: incorrect logic inversion
---------
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
* Hide account switcher in addEdit generator
* Handle AddEditCipher deserialization
* Opaque types are not serializable
* Better handle jsonification of login uris
* Ensure we don't overwrite original with clone
* Ensure cipherView prototype is always restored if it exists
* make spacing consistent between log out and lock all buttons
* update color of avatar when no active account
* separate active account from other available accounts
* remove unnecessary ng-container
* wip
* Running prettier after npm ci
* Defects AC-1929 AC-1955 AC-1956
* Setting plan and product to Teams if adding an org from a provider
* Updated logic to correctly set seat count depending on how you approach the upgrade flow
* Moved logic setting seat count to changedProduct
* Setting sm seats when upgrading to the current count
* Setting max storage if the organization's current plan has it set above the base
* Refactored logic in changedProduct to be a bit more concise. Added logic for handling sm service accounts and storage increases
* Decomposed the logic in changedProduct
* Resolved defects introduced in the merge conflict
* Changes after executing `npm run prettier`
---------
Co-authored-by: Alex Morask <amorask@bitwarden.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* migrate to DialogService
* use static method
* add reactive form dependencies
* begin migrating to reactive forms
* migrate template inputs to use CL
* update set-pin.component.ts file to work with reactive forms
* migrate desktop template and class file to Dialog and ReactiveForms
* update settings page
* remove old properties
* update settings form upon dialog close
* refactor ngOnInit()
* remove duplicate validator (already have a validator in class file)
* wip
* Running prettier after npm ci
* Defects AC-1929 AC-1955 AC-1956
* Updated logic to correctly set seat count depending on how you approach the upgrade flow
* Setting sm seats when upgrading to the current count
* Setting max storage if the organization's current plan has it set above the base
* Refactored logic in changedProduct to be a bit more concise. Added logic for handling sm service accounts and storage increases
* Decomposed the logic in changedProduct
* Resolved defects introduced in the merge conflict
---------
Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
* [deps] Tools: Update electron to v27.2.0
* Bump electronVersion to 27.2.0
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Import libs/importer and instantiate ImportService
* Create ImportApi and ImportService factories
* Add libs/importer to desktop
* [PM-4075] Setup Feature Flag for Browser Fileless Import
* [PM-4032] Detect Lastpass Export Page and Supress Download Prompt
* [PM-4032] Implementing jest tests for the FilelessImporterBackground class
* [PM-4075] Setup Feature Flag for Browser Fileless Import (#6391)
* [PM-4032] Implementing jest tests for the FilelessImporterBackground class
* [PM-4032] Implementing jest tests for the LpFilelessImporter class
* [PM-4032] Modifying variable name
* [PM-4032] Modifying verbiage on jest tests to feature present tense actions and updating behavior within FilelessImporterBackground to ensure logic is triggered on expected port names only
* [PM-4032] Modifying documentation present above handlePortOnConnect method
* [PM-4032] Modifying documentation present above handlePortOnConnect method
* [PM-4032] Applying early return if the user has a policy that removes the individual vault
* [PM-4032] Reverting change made to notification bar
* [PM-4032] Applying a static declaration to the filelessImporterPortNames property
* [PM-4032] Modifying test for handlPortOnConnect method to follow provided feedback
* [PM-4032] Applying feedback to jest test messages
* [PM-4032] Reworking LpFilelessImporter to simplify testing structure and leverage public facing methods rather than testing private methods
* [PM-4032] Reworking FilelessImporterBackground class
* [PM-4032] Adding implementation details that facilitate triggering onMessage listeners within a chrome.runtime.connection port
* [PM-4032] Implementing reworked jest tests for FilelessImporterBackground
* [PM-4032] Adjusting naming of jest test
* [PM-4032] Reworking test setup implementation to better fit approach discussed within overlay PR work
* [PM-4032] Running prettier
* [PM-4032] Removing added line break
* [PM-4033] Display import prompt to user (#6407)
* [PM-4033] Display Import Prompt to the User
* [PM-4033] Adding jest tests for LpFilelessImporter
* [PM-4033] Finalization of Jest tests
* [PM-4033] Finalization of Jest tests
* [PM-4033] Removing values from the whitelist capital letters file
* [PM-4033] Addressing jest test coverage in LpFilelessImporter
* [PM-4033] Addressing jest test coverage in LpFilelessImporter
* [PM-4033] Adding documentation to the added methods within the NotificationBackground class
* [PM-4033] Adding documentation to the added methods within the bar.ts content script
* [PM-4033] Removing unnecessary method within lp-fileless-importer content script
* [PM-4033] Removing method that is not currently used within FilelessImporterBackground
* [PM-4033] Adding jest tests for the implementation
* [PM-4035] Import LastPass Export Page Data (#6408)
* [PM-4035] Import LastPass Export Page Data
* [PM-4035] Import LastPass Export Page Data
* [PM-4035] Adding jest tests for the LPFilelessImporter class
* [PM-4035] Adding jest tests for the FilelessImporterBackground class
* [PM-4035] Fixing references to innerHtml and updating them to reference textContent
* [PM-4035] Removing eslint-disable and adding logging service to bar.ts
* [PM-4035] Adding typing information to LpImporter classes
* [PM-4035] Adding typing information to LpImporter classes
* [PM-4035] Adding typing information for FilelessImportType
* [PM-4035] Updating type reference for the filelessImportType
* [PM-4032] Refactoring implementation for NotificationBackground.doNotificationQueueCheck to remove repetition
* [PM-4032] Refactoring early returns within NotificationBackground
* [PM-4032] Adding context for a test case for the FilelessImporterBackground
* [PM-4032] Removing magic number by referencing the notification port within a test for cancelFilelessImport
* [PM-4032] Adding documentation to the constructor
* [PM-4032] Switching logic to use a switch statement rather than multiple if statements
* [PM-4032] Removing unnecessary early return from the mutation observer implementation within `lp-fileless-importer.ts
* [PM-4032] Adding return to the mutation observer when we have found the expected text node
* [PM-4032] Refactoring implementation of the handleMutation method
* [PM-4032] Modifying implementation for pushUnlocKVaultToQueue to send a notification message instead of adding the item to the queue
* [PM-4032] Modifying implementation for how we handle mutations within the lp-fileless-importer
* [PM-4032] Adding space between the iteration over added nodes within LpFilelessImporter.handleMutation
* [PM-4032] Reworking logic within the doNotificationCheck method to remove for loop
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* [PM-5303] Cannot login with SSO
* [PM-5303] Adding documentation to newly created ContentMessageHandler class
* [PM-5303] Updating manifest v3 implementation to use the newly scoped name
* [PM-5303] Adding jest tests to implementation
## Type of change
<!-- (mark with an `X`) -->
```
- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
```
## Objective
<!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding-->
Final Client changes for Key Rotation Improvements.
- Introduces a new `KeyRotationService` that is responsible for owning rotation process.
- Moves `Send` re-encryption to the `SendService` (`KeyRotationService` shouldn't have knowledge about how domains are encrypted).
- Moves `EmergencyAccess` re-encryption to the `EmergencyAccessService`.
- Renames `AccountRecoveryService` to `OrganizationUserResetPasswordService` after feedback from Admin Console
## Code changes
<!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes-->
<!--Also refer to any related changes or PRs in other repositories-->
Auth
- **emergency-access-update.request.ts:** New request model for domain updates that includes Id
- **emergency-access.service.ts:** Moved `EmergencyAccess` re-encryption to the `EmergencyAccessService`. Add deprecated method for legacy key rotations if feature flag is off
- **key-rotation.service/api/spec/module:** New key rotation service for owning the rotation process. Added api service, module, and spec file.
- **update-key.request.ts:** Moved to Auth ownership. Also added new properties for including other domains.
- **migrate-legacy-encryption.component.ts:** Use new key rotation service instead of old component specific service. Delete old service.
- **change-password.component.ts:** Use new key rotation service.
- **settings.module.ts:** Import key rotation module.
Admin Console
- **organization-user-reset-password.service.ts/spec:** Responsible for re-encryption of reset password keys during key rotation. Added tests.
- **organization-user-reset-password-enrollment.request.ts:** New request model for key rotations
- **reset-password.component.ts:** Update `AccountRecoveryService` to `OrganizationUserResetPasswordService`
- **enroll-master-password-reset.component.ts:** Update `AccountRecoveryService` to `OrganizationUserResetPasswordService`
Tools
- **send.service/spec.ts:** Responsible only for re-encryption of sends during key rotation. Added tests.
Other
- **api.service.ts:** Move `postAccountKey` to `KeyRotationApiService`
- **feature-flag.enum.ts:** add new feature flag
## Screenshots
<!--Required for any UI changes. Delete if not applicable-->
## Before you submit
- Please add **unit tests** where it makes sense to do so (encouraged but not required)
- If this change requires a **documentation update** - notify the documentation team
- If this change has particular **deployment requirements** - notify the DevOps team
- Ensure that all UI additions follow [WCAG AA requirements](https://contributing.bitwarden.com/contributing/accessibility/)