bitwarden-estensione-browser/common
Addison Beck 57351d29a2
[bug] Migrate state even if there is not a user logged in (#615)
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.
2022-01-20 08:30:00 -05:00
..
src [bug] Migrate state even if there is not a user logged in (#615) 2022-01-20 08:30:00 -05:00
package-lock.json Bump node to 16 and npm (#575) 2021-12-13 11:43:10 +01:00
package.json Bump node to 16 and npm (#575) 2021-12-13 11:43:10 +01:00
tsconfig.json Add a shared tsconfig file (#609) 2022-01-17 13:21:20 +01:00