Collapsed groupings have regressed to not maintaining their state through restarting clients.
The state mangement refactor erroniously began saving this field to memory instead of disk, but there were some other issues that changing this brought on that are also fixed in this commit.
Changes:
1. Save collapsedGroupings persistantly in StateService
2. Adjust the type of collapsedGroupings on the Account model from a Set<string> to a string[]
* This is the way we were storing this value in previous releases, and saving the entire set object breaks.
3. Adjust the StateService getter/setter for collapsedGroupings to expect a string[]
4. Extract a string[] from the GroupingsComponent groupings that is a Set<string> before saving
* Resolve hasKeyStored returning true when no biometric key is stored
* Change to use a switch statement which avoids having to fetch the key.
* Use triple equals
* Run prettier
* [bug] Fix logout timeout action for inactive accounts
* Pass userId in to the logout callback parameter to the vaultTimeoutService. The message handle in desktop already expects this.
* Set lastActive on account login, and null it on account deauthentication. This prevents an issue where newly logged in accounts immediatly time out due to inactivity.
* Add userId to locked callbacks
* Add userId to log out callback
* Add password protected export
* Run prettier
* Test password protected export service
* Create type for known import type strings
* Test import service changes
* Test bitwarden password importer
* Run prettier
* Remove unnecessary class properties
* Run prettier
* Tslint fixes
* Add KdfType to password protected export
* Linter fixes
* run prettier
* Use Identity server routes
We've moved `prelogin` and `register` endpoints to the Indentity project
Reflecting that change here
* Only update path for dev environment
* Use different strategy classes for different types of login
* General refactor and cleanup of auth logic
* Create subclasses for different types of login credentials
* Create subclasses for different types of tokenRequests
* Create TwoFactorService, move code out of authService
* refactor base CLI commands to use new interface
Some clients have unique global setting defaults (and unique global settings)
For example: the web vault defaults to light theme, but most clients with theme support default to system theme.
The current way we handle GlobalState is buried in jslib and not easily extendible in clients.
To fix this, we need to treat GlobalState as a generic in the StateService and StateMigration service and allow for its extension in those methods and anywhere GlobalState is inited.
* Add testdata, create types for keeperjson import
* Create keeperjson importer and tests
* Register, Create instance of keeperjson importer
* Move keeperCsvImporter to keeperImporters folder
* Fixed import of BaseImporter
* Removed unnecessary check for key
* Move instantiation of importer into beforeEach
* Fixed the second import with a wrong path
* Adjust types based on new test export
* Add test case for empty notes and custom fields
* Implement logic for failed test case
* Removed test expectation
* [bug] Ensure globals set before migration is run are not lost
Some fields, like biometrics, are set before we can run the state migration
For some use cases, like initial install, this can lead to migration clearing those fields when it doesn't find them in storage.
This commit sets up an order of checks for migrating globals that considers fields that may already have been set.
* [style] Ran prettier
There is a use case that overrides locally set environmentUrls: an initial boot of a logged out application.
We override environmentUrls with whatever the tempory settings store has, even if different urls are added before authenticating.
This commit ensures we always use input environmentUrls.
With the move to a central StateService we erroniously cut out search indexing from the process of setting decrypted ciphers to memory.
This commit calls the method responsible for setting decrypted ciphers and indexing when decrypting, instead of setting decrypted ciphers directly.
Some clients, like Directory Connector, use different key for their user identifier: entityId
We currently only check for userId in the migration service, but need to account for both.
A couple of helper methods were recently added to the StateMigrationService, but they were set to private and can't be used in children.
Some clients, like the Directory Connector, extend the StateMigrationService and need access to these methods.
The following data points are currently scoped to an account but are made global with this commit:
* Enable Menu Bar Icon
* Minimize To Menu Bar
* Close To Menu Bar
* Start To Menu Bar
Note: these are all electron specific fields
Currently the StateMigrationService depends on a userId key for running migrations, but if there is not an authenticated user saved to storage that userId is not present.
These changes allow for migrating state data even without an active user. For account specific settings like clearClipboard we now temporarily store those values together in disk state until an account is authed that they can be added to. Temp account state is then cleared.
Some notes:
* In order for this to work we need GlobalState.stateVersion to have a default value of StateVersion.One instead of StateVersion.Latest. Defaulting it to latest was causing migrations to not run on some clients (like desktop) that try to access storage before migrations have been run but save a version as if migrations did run.
* I also noticed we aren't clearing old state items from before migrating, and added a case for this to the migrator.
* I extracted a few bits of reused code into private methods in the stateMigration service. Things like get/set from storage, default options, etc.
* Move CLI Key Connector check out of base class
* Add missing await
* Move safe operation out of try/catch block
* Move Key Connector migration check to unlock command
* Set convertAccountRequired flag in syncService
* Remove unneeded service